-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsendmsg.mli
74 lines (63 loc) · 2.03 KB
/
sendmsg.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
(*
* Copyright (c) 2013 SRI International, Inc.
* All rights reserved.
*
* This software was developed by SRI International and the University
* of Cambridge Computer Laboratory under DARPA/AFRL contract
* (FA8750-11-C-0249) ("MRC2"), as part of the DARPA MRC research
* programme.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 2.1 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*)
(* credentials *)
type cred = {
pid : int; (* PID of sending process. *)
uid : int; (* UID of sending process. *)
gid : int; (* GID of sending process. *)
}
val getcred : unit -> cred (* credentials of caller *)
val set_recvcred : Unix.file_descr -> bool -> unit
(* Control messages that can be sent and received via sendmsg(). *)
type proto_level = int
type proto_type = int
type cmsg =
| Cmsg_generic of proto_level * proto_type * string
| Cmsg_scm_rights of Unix.file_descr list
| Cmsg_scm_credentials of cred
type send_flag =
| SEND_DONTROUTE
| SEND_DONTWAIT
| SEND_EOR
| SEND_NOSIGNAL
| SEND_OOB
type recv_flag =
| RECV_CMSG_CLOEXEC
| RECV_DONTWAIT
| RECV_OOB
| RECV_PEEK
| RECV_TRUNC
| RECV_WAITALL
type msg_flag =
| MSG_EOR
| MSG_TRUNC
| MSG_CTRUNC
| MSG_OOB
val send_flag_name : send_flag -> string
val recv_flag_name : recv_flag -> string
val msg_flag_name : msg_flag -> string
(* TODO: add the sock address in msg_name. *)
type msg = {
msg_iovec : string list; (* will contain at most one buffer on recvmsg *)
msg_cmsgs : cmsg list;
msg_flags : msg_flag list; (* ignored on sendmsg *)
}
val sendmsg : Unix.file_descr -> msg -> send_flag list -> int
val recvmsg : Unix.file_descr -> recv_flag list -> msg