| 1 |
/* SCTP kernel Implementation: User API extensions. |
| 2 |
* |
| 3 |
* opt_info.c |
| 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 |
* SCTP kernel Implementation. The main purpose of this |
| 10 |
* code if to provide the SCTP Socket API mappings for user |
| 11 |
* application to interface with the SCTP in kernel. |
| 12 |
* |
| 13 |
* This implementation is based on the Socket API Extensions for SCTP |
| 14 |
* defined in <draft-ietf-tsvwg-sctpsocket-10.txt. |
| 15 |
* |
| 16 |
* (C) Copyright IBM Corp. 2003 |
| 17 |
* Copyright (c) 2002 Intel Corporation. |
| 18 |
* |
| 19 |
* Written or modified by: |
| 20 |
* Ardelle Fan <[email protected]> |
| 21 |
*/ |
| 22 |
|
| 23 |
#include <sys/socket.h> /* struct sockaddr_storage, setsockopt() */ |
| 24 |
#include <netinet/sctp.h> /* SCTP_SOCKOPT_BINDX_* */ |
| 25 |
#include <errno.h> |
| 26 |
|
| 27 |
/* Support the sctp_opt_info() interface. |
| 28 |
* |
| 29 |
* See Sockets API Extensions for SCTP. Section 7. |
| 30 |
* |
| 31 |
* Pass sctp option information pass both in to and out of the SCTP stack. |
| 32 |
* This is a new SCTP API described in the section 7 of the Sockets API |
| 33 |
* Extensions for SCTP. This is implemented using the getsockopt() interface. |
| 34 |
*/ |
| 35 |
int |
| 36 |
sctp_opt_info(int sd, sctp_assoc_t id, int opt, void *arg, socklen_t *size) |
| 37 |
{ |
| 38 |
switch (opt) { |
| 39 |
case SCTP_RTOINFO: |
| 40 |
case SCTP_ASSOCINFO: |
| 41 |
case SCTP_INITMSG: |
| 42 |
case SCTP_NODELAY: |
| 43 |
case SCTP_AUTOCLOSE: |
| 44 |
case SCTP_PRIMARY_ADDR: |
| 45 |
case SCTP_DISABLE_FRAGMENTS: |
| 46 |
case SCTP_PEER_ADDR_PARAMS: |
| 47 |
case SCTP_DEFAULT_SEND_PARAM: |
| 48 |
case SCTP_EVENTS: |
| 49 |
case SCTP_I_WANT_MAPPED_V4_ADDR: |
| 50 |
case SCTP_MAXSEG: |
| 51 |
case SCTP_STATUS: |
| 52 |
case SCTP_GET_PEER_ADDR_INFO: |
| 53 |
case SCTP_AUTH_ACTIVE_KEY: |
| 54 |
case SCTP_PEER_AUTH_CHUNKS: |
| 55 |
case SCTP_LOCAL_AUTH_CHUNKS: |
| 56 |
*(sctp_assoc_t *)arg = id; |
| 57 |
return getsockopt(sd, IPPROTO_SCTP, opt, arg, size); |
| 58 |
default: |
| 59 |
return ENOTSUP; |
| 60 |
} |
| 61 |
|
| 62 |
} /* sctp_opt_info() */ |