sctp.h | sctp.h | |||
---|---|---|---|---|
/* SCTP kernel reference Implementation | /* SCTP kernel reference Implementation: User API extensions. | |||
* (C) Copyright IBM Corp. 2001, 2004 | ||||
* Copyright (c) 1999-2000 Cisco, Inc. | ||||
* Copyright (c) 1999-2001 Motorola, Inc. | ||||
* | * | |||
* This file is part of the SCTP kernel reference Implementation | * sctp.h | |||
* | ||||
* Distributed under the terms of the LGPL v2.1 as described in | ||||
* http://www.gnu.org/copyleft/lesser.txt | ||||
* | ||||
* This file is part of the user library that offers support for the | ||||
* SCTP kernel reference Implementation. The main purpose of this | ||||
* code is to provide the SCTP Socket API mappings for user | ||||
* application to interface with SCTP in kernel. | ||||
* | * | |||
* This header represents the structures and constants needed to support | * This header represents the structures and constants needed to support | |||
* the SCTP Extension to the Sockets API. | * the SCTP Extension to the Sockets API. | |||
* | * | |||
* The SCTP reference implementation is free software; | * (C) Copyright IBM Corp. 2001, 2004 | |||
* you can redistribute it and/or modify it under the terms of | * Copyright (c) 1999-2000 Cisco, Inc. | |||
* the GNU General Public License as published by | * Copyright (c) 1999-2001 Motorola, Inc. | |||
* the Free Software Foundation; either version 2, or (at your option) | ||||
* any later version. | ||||
* | ||||
* The SCTP reference implementation 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 General Public License for more details. | ||||
* | ||||
* You should have received a copy of the GNU General Public License | ||||
* along with GNU CC; see the file COPYING. If not, write to | ||||
* the Free Software Foundation, 59 Temple Place - Suite 330, | ||||
* Boston, MA 02111-1307, USA. | ||||
* | ||||
* Please send any bug reports or fixes you make to the | ||||
* email address(es): | ||||
* lksctp developers <lksctp-developers@lists.sourceforge.net> | ||||
* | ||||
* Or submit a bug report through the following website: | ||||
* http://www.sf.net/projects/lksctp | ||||
* | * | |||
* Written or modified by: | * Written or modified by: | |||
* La Monte H.P. Yarroll <piggy@acm.org> | * La Monte H.P. Yarroll <piggy@acm.org> | |||
* R. Stewart <randall@sctp.chicago.il.us> | * R. Stewart <randall@sctp.chicago.il.us> | |||
* K. Morneau <kmorneau@cisco.com> | * K. Morneau <kmorneau@cisco.com> | |||
* Q. Xie <qxie1@email.mot.com> | * Q. Xie <qxie1@email.mot.com> | |||
* Karl Knutson <karl@athena.chicago.il.us> | * Karl Knutson <karl@athena.chicago.il.us> | |||
* Jon Grimm <jgrimm@austin.ibm.com> | * Jon Grimm <jgrimm@austin.ibm.com> | |||
* Daisy Chang <daisyc@us.ibm.com> | * Daisy Chang <daisyc@us.ibm.com> | |||
* Inaky Perez-Gonzalez <inaky.gonzalez@intel.com> | * Inaky Perez-Gonzalez <inaky.gonzalez@intel.com> | |||
* Sridhar Samudrala <sri@us.ibm.com> | * Sridhar Samudrala <sri@us.ibm.com> | |||
* | ||||
* Any bugs reported given to us we will try to fix... any fixes shared wil | ||||
l | ||||
* be incorporated into the next SCTP release. | ||||
*/ | */ | |||
#ifndef __linux_sctp_h__ | #ifndef __linux_sctp_h__ | |||
#define __linux_sctp_h__ | #define __linux_sctp_h__ | |||
#include <stdint.h> | #include <stdint.h> | |||
#include <linux/types.h> | #include <linux/types.h> | |||
#include <sys/socket.h> | #include <sys/socket.h> | |||
__BEGIN_DECLS | __BEGIN_DECLS | |||
skipping to change at line 75 | skipping to change at line 57 | |||
#ifndef IPPROTO_SCTP | #ifndef IPPROTO_SCTP | |||
#define IPPROTO_SCTP 132 | #define IPPROTO_SCTP 132 | |||
#endif | #endif | |||
/* 9. Preprocessor constants */ | /* 9. Preprocessor constants */ | |||
#define HAVE_SCTP | #define HAVE_SCTP | |||
#define HAVE_KERNEL_SCTP | #define HAVE_KERNEL_SCTP | |||
#define HAVE_SCTP_MULTIBUF | #define HAVE_SCTP_MULTIBUF | |||
#define HAVE_SCTP_NOCONNECT | #define HAVE_SCTP_NOCONNECT | |||
#define HAVE_SCTP_PRSCTP | ||||
#define HAVE_SCTP_ADDIP | ||||
#define HAVE_SCTP_CANSET_PRIMARY | ||||
/* The following symbols come from the Sockets API Extensions for | /* The following symbols come from the Sockets API Extensions for | |||
* SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>. | * SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>. | |||
*/ | */ | |||
enum sctp_optname { | enum sctp_optname { | |||
SCTP_RTOINFO, | SCTP_RTOINFO, | |||
#define SCTP_RTOINFO SCTP_RTOINFO | #define SCTP_RTOINFO SCTP_RTOINFO | |||
SCTP_ASSOCINFO, | SCTP_ASSOCINFO, | |||
#define SCTP_ASSOCINFO SCTP_ASSOCINFO | #define SCTP_ASSOCINFO SCTP_ASSOCINFO | |||
SCTP_INITMSG, | SCTP_INITMSG, | |||
skipping to change at line 122 | skipping to change at line 107 | |||
/* Internal Socket Options. Some of the sctp library functions are | /* Internal Socket Options. Some of the sctp library functions are | |||
* implemented using these socket options. | * implemented using these socket options. | |||
*/ | */ | |||
SCTP_SOCKOPT_BINDX_ADD = 100,/* BINDX requests for adding addresses. */ | SCTP_SOCKOPT_BINDX_ADD = 100,/* BINDX requests for adding addresses. */ | |||
#define SCTP_SOCKOPT_BINDX_ADD SCTP_SOCKOPT_BINDX_ADD | #define SCTP_SOCKOPT_BINDX_ADD SCTP_SOCKOPT_BINDX_ADD | |||
SCTP_SOCKOPT_BINDX_REM, /* BINDX requests for removing addresses. */ | SCTP_SOCKOPT_BINDX_REM, /* BINDX requests for removing addresses. */ | |||
#define SCTP_SOCKOPT_BINDX_REM SCTP_SOCKOPT_BINDX_REM | #define SCTP_SOCKOPT_BINDX_REM SCTP_SOCKOPT_BINDX_REM | |||
SCTP_SOCKOPT_PEELOFF, /* peel off association. */ | SCTP_SOCKOPT_PEELOFF, /* peel off association. */ | |||
#define SCTP_SOCKOPT_PEELOFF SCTP_SOCKOPT_PEELOFF | #define SCTP_SOCKOPT_PEELOFF SCTP_SOCKOPT_PEELOFF | |||
SCTP_GET_PEER_ADDRS_NUM, /* Get number of peer addresss. */ | SCTP_GET_PEER_ADDRS_NUM_OLD, /* Get number of peer addresss. */ | |||
#define SCTP_GET_PEER_ADDRS_NUM SCTP_GET_PEER_ADDRS_NUM | #define SCTP_GET_PEER_ADDRS_NUM_OLD SCTP_GET_PEER_ADDRS_NUM_OLD | |||
SCTP_GET_PEER_ADDRS, /* Get all peer addresss. */ | SCTP_GET_PEER_ADDRS_OLD, /* Get all peer addresss. */ | |||
#define SCTP_GET_PEER_ADDRS SCTP_GET_PEER_ADDRS | #define SCTP_GET_PEER_ADDRS_OLD SCTP_GET_PEER_ADDRS_OLD | |||
SCTP_GET_LOCAL_ADDRS_NUM, /* Get number of local addresss. */ | SCTP_GET_LOCAL_ADDRS_NUM_OLD, /* Get number of local addresss. */ | |||
#define SCTP_GET_LOCAL_ADDRS_NUM SCTP_GET_LOCAL_ADDRS_NUM | #define SCTP_GET_LOCAL_ADDRS_NUM_OLD SCTP_GET_LOCAL_ADDRS_NUM_OLD | |||
SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */ | SCTP_GET_LOCAL_ADDRS_OLD, /* Get all local addresss. */ | |||
#define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS | #define SCTP_GET_LOCAL_ADDRS_OLD SCTP_GET_LOCAL_ADDRS_OLD | |||
SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */ | ||||
#define SCTP_SOCKOPT_CONNECTX SCTP_SOCKOPT_CONNECTX | ||||
SCTP_GET_PEER_ADDRS, /* Get all peer addresss. */ | ||||
#define SCTP_GET_PEER_ADDRS SCTP_GET_PEER_ADDRS | ||||
SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */ | ||||
#define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS | ||||
}; | }; | |||
/* | /* | |||
* 5.2.1 SCTP Initiation Structure (SCTP_INIT) | * 5.2.1 SCTP Initiation Structure (SCTP_INIT) | |||
* | * | |||
* This cmsghdr structure provides information for initializing new | * This cmsghdr structure provides information for initializing new | |||
* SCTP associations with sendmsg(). The SCTP_INITMSG socket option | * SCTP associations with sendmsg(). The SCTP_INITMSG socket option | |||
* uses this same data structure. This structure is not used for | * uses this same data structure. This structure is not used for | |||
* recvmsg(). | * recvmsg(). | |||
* | * | |||
skipping to change at line 184 | skipping to change at line 175 | |||
}; | }; | |||
/* | /* | |||
* sinfo_flags: 16 bits (unsigned integer) | * sinfo_flags: 16 bits (unsigned integer) | |||
* | * | |||
* This field may contain any of the following flags and is composed of | * This field may contain any of the following flags and is composed of | |||
* a bitwise OR of these values. | * a bitwise OR of these values. | |||
*/ | */ | |||
enum sctp_sinfo_flags { | enum sctp_sinfo_flags { | |||
MSG_UNORDERED = 1, /* Send/receive message unordered. */ | SCTP_UNORDERED = 1, /* Send/receive message unordered. */ | |||
MSG_ADDR_OVER = 2, /* Override the primary destination. */ | SCTP_ADDR_OVER = 2, /* Override the primary destination. */ | |||
MSG_ABORT=4, /* Send an ABORT message to the peer. */ | SCTP_ABORT=4, /* Send an ABORT message to the peer. */ | |||
MSG_EOF=MSG_FIN, /* Initiate graceful shutdown process. */ | SCTP_EOF=MSG_FIN, /* Initiate graceful shutdown process. */ | |||
}; | }; | |||
typedef union { | typedef union { | |||
__u8 raw; | __u8 raw; | |||
struct sctp_initmsg init; | struct sctp_initmsg init; | |||
struct sctp_sndrcvinfo sndrcv; | struct sctp_sndrcvinfo sndrcv; | |||
} sctp_cmsg_data_t; | } sctp_cmsg_data_t; | |||
/* These are cmsg_types. */ | /* These are cmsg_types. */ | |||
typedef enum sctp_cmsg_type { | typedef enum sctp_cmsg_type { | |||
skipping to change at line 254 | skipping to change at line 245 | |||
* following structure: | * following structure: | |||
*/ | */ | |||
struct sctp_paddr_change { | struct sctp_paddr_change { | |||
__u16 spc_type; | __u16 spc_type; | |||
__u16 spc_flags; | __u16 spc_flags; | |||
__u32 spc_length; | __u32 spc_length; | |||
struct sockaddr_storage spc_aaddr; | struct sockaddr_storage spc_aaddr; | |||
int spc_state; | int spc_state; | |||
int spc_error; | int spc_error; | |||
sctp_assoc_t spc_assoc_id; | sctp_assoc_t spc_assoc_id; | |||
}; | } __attribute__((packed, aligned(4))); | |||
/* | /* | |||
* spc_state: 32 bits (signed integer) | * spc_state: 32 bits (signed integer) | |||
* | * | |||
* This field holds one of a number of values that communicate the | * This field holds one of a number of values that communicate the | |||
* event that happened to the address. They include: | * event that happened to the address. They include: | |||
*/ | */ | |||
enum sctp_spc_state { | enum sctp_spc_state { | |||
SCTP_ADDR_AVAILABLE, | SCTP_ADDR_AVAILABLE, | |||
SCTP_ADDR_UNREACHABLE, | SCTP_ADDR_UNREACHABLE, | |||
skipping to change at line 477 | skipping to change at line 468 | |||
* 7.1.9 Set Peer Primary Address (SCTP_SET_PEER_PRIMARY_ADDR) | * 7.1.9 Set Peer Primary Address (SCTP_SET_PEER_PRIMARY_ADDR) | |||
* | * | |||
* Requests that the peer mark the enclosed address as the association | * Requests that the peer mark the enclosed address as the association | |||
* primary. The enclosed address must be one of the association's | * primary. The enclosed address must be one of the association's | |||
* locally bound addresses. The following structure is used to make a | * locally bound addresses. The following structure is used to make a | |||
* set primary request: | * set primary request: | |||
*/ | */ | |||
struct sctp_setpeerprim { | struct sctp_setpeerprim { | |||
sctp_assoc_t sspp_assoc_id; | sctp_assoc_t sspp_assoc_id; | |||
struct sockaddr_storage sspp_addr; | struct sockaddr_storage sspp_addr; | |||
}; | } __attribute__((packed, aligned(4))); | |||
/* | /* | |||
* 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR) | * 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR) | |||
* | * | |||
* Requests that the local SCTP stack use the enclosed peer address as | * Requests that the local SCTP stack use the enclosed peer address as | |||
* the association primary. The enclosed address must be one of the | * the association primary. The enclosed address must be one of the | |||
* association peer's addresses. The following structure is used to | * association peer's addresses. The following structure is used to | |||
* make a set peer primary request: | * make a set peer primary request: | |||
*/ | */ | |||
struct sctp_prim { | struct sctp_prim { | |||
sctp_assoc_t ssp_assoc_id; | sctp_assoc_t ssp_assoc_id; | |||
struct sockaddr_storage ssp_addr; | struct sockaddr_storage ssp_addr; | |||
}; | } __attribute__((packed, aligned(4))); | |||
/* | /* | |||
* 7.1.11 Set Adaption Layer Indicator (SCTP_ADAPTION_LAYER) | * 7.1.11 Set Adaption Layer Indicator (SCTP_ADAPTION_LAYER) | |||
* | * | |||
* Requests that the local endpoint set the specified Adaption Layer | * Requests that the local endpoint set the specified Adaption Layer | |||
* Indication parameter for all future INIT and INIT-ACK exchanges. | * Indication parameter for all future INIT and INIT-ACK exchanges. | |||
*/ | */ | |||
struct sctp_setadaption { | struct sctp_setadaption { | |||
__u32 ssb_adaption_ind; | __u32 ssb_adaption_ind; | |||
}; | }; | |||
skipping to change at line 517 | skipping to change at line 508 | |||
* heartbeat to be sent immediately, and adjust the address's maximum | * heartbeat to be sent immediately, and adjust the address's maximum | |||
* number of retransmissions sent before an address is considered | * number of retransmissions sent before an address is considered | |||
* unreachable. The following structure is used to access and modify an | * unreachable. The following structure is used to access and modify an | |||
* address's parameters: | * address's parameters: | |||
*/ | */ | |||
struct sctp_paddrparams { | struct sctp_paddrparams { | |||
sctp_assoc_t spp_assoc_id; | sctp_assoc_t spp_assoc_id; | |||
struct sockaddr_storage spp_address; | struct sockaddr_storage spp_address; | |||
__u32 spp_hbinterval; | __u32 spp_hbinterval; | |||
__u16 spp_pathmaxrxt; | __u16 spp_pathmaxrxt; | |||
}; | } __attribute__((packed, aligned(4))); | |||
/* | /* | |||
* 7.2.2 Peer Address Information | * 7.2.2 Peer Address Information | |||
* | * | |||
* Applications can retrieve information about a specific peer address | * Applications can retrieve information about a specific peer address | |||
* of an association, including its reachability state, congestion | * of an association, including its reachability state, congestion | |||
* window, and retransmission timer values. This information is | * window, and retransmission timer values. This information is | |||
* read-only. The following structure is used to access this | * read-only. The following structure is used to access this | |||
* information: | * information: | |||
*/ | */ | |||
struct sctp_paddrinfo { | struct sctp_paddrinfo { | |||
sctp_assoc_t spinfo_assoc_id; | sctp_assoc_t spinfo_assoc_id; | |||
struct sockaddr_storage spinfo_address; | struct sockaddr_storage spinfo_address; | |||
__s32 spinfo_state; | __s32 spinfo_state; | |||
__u32 spinfo_cwnd; | __u32 spinfo_cwnd; | |||
__u32 spinfo_srtt; | __u32 spinfo_srtt; | |||
__u32 spinfo_rto; | __u32 spinfo_rto; | |||
__u32 spinfo_mtu; | __u32 spinfo_mtu; | |||
}; | } __attribute__((packed, aligned(4))); | |||
/* Peer addresses's state. */ | /* Peer addresses's state. */ | |||
enum sctp_spinfo_state { | enum sctp_spinfo_state { | |||
SCTP_INACTIVE, | SCTP_INACTIVE, | |||
SCTP_ACTIVE, | SCTP_ACTIVE, | |||
}; | }; | |||
/* | /* | |||
* 7.2.1 Association Status (SCTP_STATUS) | * 7.2.1 Association Status (SCTP_STATUS) | |||
* | * | |||
skipping to change at line 584 | skipping to change at line 575 | |||
SCTP_SHUTDOWN_RECEIVED = 7, | SCTP_SHUTDOWN_RECEIVED = 7, | |||
SCTP_SHUTDOWN_ACK_SENT = 8, | SCTP_SHUTDOWN_ACK_SENT = 8, | |||
}; | }; | |||
/* | /* | |||
* 8.3, 8.5 get all peer/local addresses in an association. | * 8.3, 8.5 get all peer/local addresses in an association. | |||
* This parameter struct is used by SCTP_GET_PEER_ADDRS and | * This parameter struct is used by SCTP_GET_PEER_ADDRS and | |||
* SCTP_GET_LOCAL_ADDRS socket options used internally to implement | * SCTP_GET_LOCAL_ADDRS socket options used internally to implement | |||
* sctp_getpaddrs() and sctp_getladdrs() API. | * sctp_getpaddrs() and sctp_getladdrs() API. | |||
*/ | */ | |||
struct sctp_getaddrs { | struct sctp_getaddrs_old { | |||
sctp_assoc_t assoc_id; | sctp_assoc_t assoc_id; | |||
int addr_num; | int addr_num; | |||
struct sockaddr *addrs; | struct sockaddr *addrs; | |||
}; | }; | |||
struct sctp_getaddrs { | ||||
sctp_assoc_t assoc_id; /*input*/ | ||||
__u32 addr_num; /*output*/ | ||||
__u8 addrs[0]; /*output, variable size*/ | ||||
}; | ||||
/* These are bit fields for msghdr->msg_flags. See section 5.1. */ | /* These are bit fields for msghdr->msg_flags. See section 5.1. */ | |||
/* On user space Linux, these live in <bits/socket.h> as an enum. */ | /* On user space Linux, these live in <bits/socket.h> as an enum. */ | |||
enum sctp_msg_flags { | enum sctp_msg_flags { | |||
MSG_NOTIFICATION = 0x8000, | MSG_NOTIFICATION = 0x8000, | |||
#define MSG_NOTIFICATION MSG_NOTIFICATION | #define MSG_NOTIFICATION MSG_NOTIFICATION | |||
}; | }; | |||
/* | /* | |||
* 8.1 sctp_bindx() | * 8.1 sctp_bindx() | |||
skipping to change at line 616 | skipping to change at line 612 | |||
/* This is the structure that is passed as an argument(optval) to | /* This is the structure that is passed as an argument(optval) to | |||
* getsockopt(SCTP_SOCKOPT_PEELOFF). | * getsockopt(SCTP_SOCKOPT_PEELOFF). | |||
*/ | */ | |||
typedef struct { | typedef struct { | |||
sctp_assoc_t associd; | sctp_assoc_t associd; | |||
int sd; | int sd; | |||
} sctp_peeloff_arg_t; | } sctp_peeloff_arg_t; | |||
int sctp_bindx(int sd, struct sockaddr *addrs, int addrcnt, int flags); | int sctp_bindx(int sd, struct sockaddr *addrs, int addrcnt, int flags); | |||
int sctp_connectx(int sd, struct sockaddr *addrs, int addrcnt); | ||||
int sctp_peeloff(int sd, sctp_assoc_t assoc_id); | int sctp_peeloff(int sd, sctp_assoc_t assoc_id); | |||
/* Prototype for the library function sctp_opt_info defined in | /* Prototype for the library function sctp_opt_info defined in | |||
* API 7. Socket Options. | * API 7. Socket Options. | |||
*/ | */ | |||
int sctp_opt_info(int sd, sctp_assoc_t id, int opt, void *arg, socklen_t *s ize); | int sctp_opt_info(int sd, sctp_assoc_t id, int opt, void *arg, socklen_t *s ize); | |||
/* Get all peer address on a socket. This is a new SCTP API | /* Get all peer address on a socket. This is a new SCTP API | |||
* described in the section 8.3 of the Sockets API Extensions for SCTP. | * described in the section 8.3 of the Sockets API Extensions for SCTP. | |||
* This is implemented using the getsockopt() interface. | * This is implemented using the getsockopt() interface. | |||
skipping to change at line 654 | skipping to change at line 652 | |||
/* This library function assists the user with the advanced features | /* This library function assists the user with the advanced features | |||
* of SCTP. This is a new SCTP API described in the section 8.7 of the | * of SCTP. This is a new SCTP API described in the section 8.7 of the | |||
* Sockets API Extensions for SCTP. This is implemented using the | * Sockets API Extensions for SCTP. This is implemented using the | |||
* sendmsg() interface. | * sendmsg() interface. | |||
*/ | */ | |||
int sctp_sendmsg(int s, const void *msg, size_t len, struct sockaddr *to, | int sctp_sendmsg(int s, const void *msg, size_t len, struct sockaddr *to, | |||
socklen_t tolen, uint32_t ppid, uint32_t flags, | socklen_t tolen, uint32_t ppid, uint32_t flags, | |||
uint16_t stream_no, uint32_t timetolive, uint32_t context); | uint16_t stream_no, uint32_t timetolive, uint32_t context); | |||
/* This library function assist the user with sending a message without | ||||
* dealing directly with the CMSG header. | ||||
*/ | ||||
int sctp_send(int s, const void *msg, size_t len, | ||||
const struct sctp_sndrcvinfo *sinfo, int flags); | ||||
/* This library function assists the user with the advanced features | /* This library function assists the user with the advanced features | |||
* of SCTP. This is a new SCTP API described in the section 8.8 of the | * of SCTP. This is a new SCTP API described in the section 8.8 of the | |||
* Sockets API Extensions for SCTP. This is implemented using the | * Sockets API Extensions for SCTP. This is implemented using the | |||
* recvmsg() interface. | * recvmsg() interface. | |||
*/ | */ | |||
int sctp_recvmsg(int s, void *msg, size_t len, struct sockaddr *from, | int sctp_recvmsg(int s, void *msg, size_t len, struct sockaddr *from, | |||
socklen_t *fromlen, struct sctp_sndrcvinfo *sinfo, | socklen_t *fromlen, struct sctp_sndrcvinfo *sinfo, | |||
int *msg_flags); | int *msg_flags); | |||
__END_DECLS | __END_DECLS | |||
End of changes. 16 change blocks. | ||||
50 lines changed or deleted | 53 lines changed or added | |||