Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Convenience fun to open character devices

  • Loading branch information...
commit a1310c1e3684b0b30acc3fd3621e58748a403fc8 1 parent f90dd1b
@msantos authored
Showing with 5 additions and 1 deletion.
  1. +1 −1  src/bpf.erl
  2. +4 −0 src/procket.erl
View
2  src/bpf.erl
@@ -110,7 +110,7 @@
open(Dev) ->
- {ok, Socket} = procket:open(0, [{dev, "bpf"}]),
+ {ok, Socket} = procket:dev("bpf"),
% Set the interface for the bpf
{ok, _} = attr(Socket, setif, Dev),
View
4 src/procket.erl
@@ -34,6 +34,7 @@
-export([
init/0,
open/1,open/2,
+ dev/1,
socket/3,
listen/1,listen/2,
connect/2,
@@ -136,6 +137,9 @@ setsockopt(_,_,_,_) ->
erlang:error(not_implemented).
+dev(Dev) when is_list(Dev) ->
+ open(0, [{dev, Dev}]).
+
open(Port) ->
open(Port, []).
open(Port, Options) when is_integer(Port), is_list(Options) ->
Please sign in to comment.
Something went wrong with that request. Please try again.