Skip to content

Commit 3834251

Browse files
committed
Move Rawlink_cstruct.ml into rawlink.ml
1 parent 3c3874e commit 3834251

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

.merlin

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ S lib
33
B _build/lib
44
PKG lwt
55
PKG cstruct
6-
EXT nonrec
6+
PKG cstruct.ppx

lib/rawlink.ml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1515
*)
1616

17+
[%%cstruct
18+
type bpf_hdr = {
19+
bh_sec: uint32_t;
20+
bh_usec: uint32_t;
21+
bh_caplen: uint32_t;
22+
bh_datalen: uint32_t;
23+
bh_hdrlen: uint16_t;
24+
} [@@little_endian]]
25+
1726
type t = {
1827
fd : Unix.file_descr;
1928
packets : Cstruct.t list ref;
@@ -47,7 +56,6 @@ let send_packet t buf =
4756
raise (Unix.Unix_error(Unix.ENOBUFS, "send_packet: short write", ""))
4857

4958
let bpf_split_buffer buffer len =
50-
let open Rawlink_cstruct in
5159
let rec loop buffer n packets =
5260
if n <= 0 then
5361
List.rev packets
@@ -70,7 +78,6 @@ let rec read_packet t =
7078
| hd :: tl -> t.packets := tl; hd
7179
| [] -> match driver () with
7280
| BPF ->
73-
let open Rawlink_cstruct in
7481
let n = unix_bytes_read t.fd t.buffer.Cstruct.buffer 0 t.buffer.Cstruct.len in
7582
if n = 0 then
7683
failwith "Link socket closed";

lib/rawlink.mllib

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
Rawlink
22
Lwt_rawlink
3-
Rawlink_cstruct

lib/rawlink_cstruct.ml

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)