Debian Codegraph @

src/include/netinet/sctp.h.in

raw
1 /* SCTP kernel Implementation: User API extensions.
2 *
3 * sctp.h
4 *
5 * Distributed under the terms of the LGPL v2.1 as described in
6 * http://www.gnu.org/copyleft/lesser.txt
7 *
8 * This file is part of the user library that offers support for the
9 * Linux Kernel SCTP Implementation. The main purpose of this
10 * code is to provide the SCTP Socket API mappings for user
11 * application to interface with SCTP in kernel.
12 *
13 * This header represents the structures and constants needed to support
14 * the SCTP Extension to the Sockets API.
15 *
16 * (C) Copyright IBM Corp. 2001, 2004
17 * Copyright (c) 1999-2000 Cisco, Inc.
18 * Copyright (c) 1999-2001 Motorola, Inc.
19 *
20 * Written or modified by:
21 * La Monte H.P. Yarroll <[email protected]>
22 * R. Stewart <[email protected]>
23 * K. Morneau <[email protected]>
24 * Q. Xie <[email protected]>
25 * Karl Knutson <[email protected]>
26 * Jon Grimm <[email protected]>
27 * Daisy Chang <[email protected]>
28 * Inaky Perez-Gonzalez <[email protected]>
29 * Sridhar Samudrala <[email protected]>
30 * Vlad Yasevich <[email protected]>
31 */
32
33 #ifndef __linux_sctp_h__
34 #define __linux_sctp_h__
35
36 #include <stdint.h>
37 #include <linux/types.h>
38 #include <sys/socket.h>
39 #include <linux/sctp.h>
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45 /* Socket option layer for SCTP */
46 #ifndef SOL_SCTP
47 #define SOL_SCTP 132
48 #endif
49
50 #ifndef IPPROTO_SCTP
51 #define IPPROTO_SCTP 132
52 #endif
53
54 /* 9. Preprocessor constants */
55 #define HAVE_SCTP
56 #define HAVE_KERNEL_SCTP
57 #define HAVE_SCTP_MULTIBUF
58 #define HAVE_SCTP_NOCONNECT
59 #define HAVE_SCTP_PRSCTP
60 #define HAVE_SCTP_ADDIP
61 #define HAVE_SCTP_CANSET_PRIMARY
62
63 #undef HAVE_SCTP_STREAM_RESET_EVENT
64 #undef HAVE_SCTP_STREAM_RECONFIG
65 #undef HAVE_SCTP_PEELOFF_FLAGS
66 #undef HAVE_SCTP_PDAPI_EVENT_PDAPI_STREAM
67 #undef HAVE_SCTP_PDAPI_EVENT_PDAPI_SEQ
68 #undef HAVE_SCTP_SENDV
69 #undef HAVE_SCTP_AUTH_NO_AUTH
70 #undef HAVE_SCTP_SPP_IPV6_FLOWLABEL
71 #undef HAVE_SCTP_SPP_DSCP
72
73 int sctp_bindx(int sd, struct sockaddr *addrs, int addrcnt, int flags);
74
75 int sctp_connectx(int sd, struct sockaddr *addrs, int addrcnt,
76 sctp_assoc_t *id);
77
78 int sctp_peeloff(int sd, sctp_assoc_t assoc_id);
79 int sctp_peeloff_flags(int sd, sctp_assoc_t assoc_id, unsigned flags);
80
81 /* Prototype for the library function sctp_opt_info defined in
82 * API 7. Socket Options.
83 */
84 int sctp_opt_info(int sd, sctp_assoc_t id, int opt, void *arg, socklen_t *size);
85
86 /* Get all peer address on a socket. This is a new SCTP API
87 * described in the section 8.3 of the Sockets API Extensions for SCTP.
88 * This is implemented using the getsockopt() interface.
89 */
90 int sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockaddr **addrs);
91
92 /* Frees all resources allocated by sctp_getpaddrs(). This is a new SCTP API
93 * described in the section 8.4 of the Sockets API Extensions for SCTP.
94 */
95 int sctp_freepaddrs(struct sockaddr *addrs);
96
97 /* Get all locally bound address on a socket. This is a new SCTP API
98 * described in the section 8.5 of the Sockets API Extensions for SCTP.
99 * This is implemented using the getsockopt() interface.
100 */
101 int sctp_getladdrs(int sd, sctp_assoc_t id, struct sockaddr **addrs);
102
103 /* Frees all resources allocated by sctp_getladdrs(). This is a new SCTP API
104 * described in the section 8.6 of the Sockets API Extensions for SCTP.
105 */
106 int sctp_freeladdrs(struct sockaddr *addrs);
107
108 /* This library function assists the user with the advanced features
109 * of SCTP. This is a new SCTP API described in the section 8.7 of the
110 * Sockets API Extensions for SCTP. This is implemented using the
111 * sendmsg() interface.
112 */
113 int sctp_sendmsg(int s, const void *msg, size_t len, struct sockaddr *to,
114 socklen_t tolen, uint32_t ppid, uint32_t flags,
115 uint16_t stream_no, uint32_t timetolive, uint32_t context);
116
117 /* This library function assist the user with sending a message without
118 * dealing directly with the CMSG header.
119 */
120 int sctp_send(int s, const void *msg, size_t len,
121 const struct sctp_sndrcvinfo *sinfo, int flags);
122
123 /* This library function assists the user with the advanced features
124 * of SCTP. This is a new SCTP API described in the section 8.8 of the
125 * Sockets API Extensions for SCTP. This is implemented using the
126 * recvmsg() interface.
127 */
128 int sctp_recvmsg(int s, void *msg, size_t len, struct sockaddr *from,
129 socklen_t *fromlen, struct sctp_sndrcvinfo *sinfo,
130 int *msg_flags);
131
132 /* Return the address length for an address family. */
133 int sctp_getaddrlen(sa_family_t family);
134
135
136 #ifdef HAVE_SCTP_SENDV
137 /* sendv infotype */
138 enum {
139 SCTP_SENDV_NOINFO,
140 SCTP_SENDV_SNDINFO,
141 SCTP_SENDV_PRINFO,
142 SCTP_SENDV_AUTHINFO,
143 SCTP_SENDV_SPA
144 };
145
146 /* sendv_flags */
147 #define SCTP_SEND_SNDINFO_VALID 0x1
148 #define SCTP_SEND_PRINFO_VALID 0x2
149 #define SCTP_SEND_AUTHINFO_VALID 0x4
150 #endif
151
152 struct sctp_sendv_spa {
153 uint32_t sendv_flags;
154 struct sctp_sndinfo sendv_sndinfo;
155 #ifdef HAVE_SCTP_SENDV
156 struct sctp_prinfo sendv_prinfo;
157 struct sctp_authinfo sendv_authinfo;
158 #endif
159 };
160
161 #ifdef HAVE_SCTP_SENDV
162 int sctp_sendv(int s, const struct iovec *iov, int iovcnt,
163 struct sockaddr *addrs, int addrcnt, void *info,
164 socklen_t infolen, unsigned int infotype, int flags);
165
166 /* recvv infotype */
167 enum {
168 SCTP_RECVV_NOINFO,
169 SCTP_RECVV_RCVINFO,
170 SCTP_RECVV_NXTINFO,
171 SCTP_RECVV_RN
172 };
173
174 struct sctp_recvv_rn {
175 struct sctp_rcvinfo recvv_rcvinfo;
176 struct sctp_nxtinfo recvv_nxtinfo;
177 };
178
179 int sctp_recvv(int s, const struct iovec *iov, int iovlen,
180 struct sockaddr *from, socklen_t *fromlen, void *info,
181 socklen_t *infolen, unsigned int *infotype, int *flags);
182 #endif
183
184 #ifdef __cplusplus
185 }
186 #endif
187
188 #endif /* __linux_sctp_h__ */