1*74e20cfeSnh145002 /* 2*74e20cfeSnh145002 * CDDL HEADER START 3*74e20cfeSnh145002 * 4*74e20cfeSnh145002 * The contents of this file are subject to the terms of the 5*74e20cfeSnh145002 * Common Development and Distribution License (the "License"). 6*74e20cfeSnh145002 * You may not use this file except in compliance with the License. 7*74e20cfeSnh145002 * 8*74e20cfeSnh145002 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*74e20cfeSnh145002 * or http://www.opensolaris.org/os/licensing. 10*74e20cfeSnh145002 * See the License for the specific language governing permissions 11*74e20cfeSnh145002 * and limitations under the License. 12*74e20cfeSnh145002 * 13*74e20cfeSnh145002 * When distributing Covered Code, include this CDDL HEADER in each 14*74e20cfeSnh145002 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*74e20cfeSnh145002 * If applicable, add the following below this CDDL HEADER, with the 16*74e20cfeSnh145002 * fields enclosed by brackets "[]" replaced with your own identifying 17*74e20cfeSnh145002 * information: Portions Copyright [yyyy] [name of copyright owner] 18*74e20cfeSnh145002 * 19*74e20cfeSnh145002 * CDDL HEADER END 20*74e20cfeSnh145002 */ 21*74e20cfeSnh145002 /* 22*74e20cfeSnh145002 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23*74e20cfeSnh145002 * Use is subject to license terms. 24*74e20cfeSnh145002 */ 25*74e20cfeSnh145002 26*74e20cfeSnh145002 #ifndef _INET_SDP_ITF_H 27*74e20cfeSnh145002 #define _INET_SDP_ITF_H 28*74e20cfeSnh145002 29*74e20cfeSnh145002 #pragma ident "%Z%%M% %I% %E% SMI" 30*74e20cfeSnh145002 31*74e20cfeSnh145002 #ifdef __cplusplus 32*74e20cfeSnh145002 extern "C" { 33*74e20cfeSnh145002 #endif 34*74e20cfeSnh145002 35*74e20cfeSnh145002 /* 36*74e20cfeSnh145002 * Kernel SDP programming interface. Note that this interface 37*74e20cfeSnh145002 * is private to Sun and can be changed without notice. 38*74e20cfeSnh145002 */ 39*74e20cfeSnh145002 40*74e20cfeSnh145002 #ifdef _KERNEL 41*74e20cfeSnh145002 42*74e20cfeSnh145002 /* 43*74e20cfeSnh145002 * The version number of the SDP kernel interface. Use it with 44*74e20cfeSnh145002 * sdp_itf_ver() to verify if the kernel supports the correct 45*74e20cfeSnh145002 * version of the interface. 46*74e20cfeSnh145002 * 47*74e20cfeSnh145002 * NOTE: do not assume backward compatibility of the interface. 48*74e20cfeSnh145002 * If the return value of sdp_itf_ver() is different from what 49*74e20cfeSnh145002 * is expected, do not call any of the routines. 50*74e20cfeSnh145002 */ 51*74e20cfeSnh145002 #define SDP_ITF_VER 1 52*74e20cfeSnh145002 53*74e20cfeSnh145002 /* 54*74e20cfeSnh145002 * This struct holds all the upcalls the SDP kernel module will 55*74e20cfeSnh145002 * invoke for different events. When calling sdp_create() to create 56*74e20cfeSnh145002 * a SDP handle, the caller must provide this information. 57*74e20cfeSnh145002 */ 58*74e20cfeSnh145002 typedef struct sdp_upcalls_s { 59*74e20cfeSnh145002 void * (*su_newconn)(void *parenthandle, void *connind); 60*74e20cfeSnh145002 void (*su_connected)(void *handle); 61*74e20cfeSnh145002 void (*su_disconnected)(void *handle, int error); 62*74e20cfeSnh145002 void (*su_connfailed)(void *handle, int error); 63*74e20cfeSnh145002 int (*su_recv)(void *handle, mblk_t *mp, int flags); 64*74e20cfeSnh145002 void (*su_xmitted)(void *handle, int writeable); 65*74e20cfeSnh145002 void (*su_urgdata)(void *handle); 66*74e20cfeSnh145002 void (*su_ordrel)(void *handle); 67*74e20cfeSnh145002 } sdp_upcalls_t; 68*74e20cfeSnh145002 69*74e20cfeSnh145002 70*74e20cfeSnh145002 /* 71*74e20cfeSnh145002 * This struct holds various flow control limits the caller of 72*74e20cfeSnh145002 * sdp_create() should observe when interacting with SDP. 73*74e20cfeSnh145002 */ 74*74e20cfeSnh145002 typedef struct sdp_sockbuf_limits_s { 75*74e20cfeSnh145002 int sbl_rxbuf; 76*74e20cfeSnh145002 int sbl_rxlowat; 77*74e20cfeSnh145002 int sbl_txbuf; 78*74e20cfeSnh145002 int sbl_txlowat; 79*74e20cfeSnh145002 } sdp_sockbuf_limits_t; 80*74e20cfeSnh145002 81*74e20cfeSnh145002 struct sdp_conn_struct_t; 82*74e20cfeSnh145002 83*74e20cfeSnh145002 /* 84*74e20cfeSnh145002 * The list of routines the SDP kernel module provides. 85*74e20cfeSnh145002 */ 86*74e20cfeSnh145002 extern int sdp_bind(struct sdp_conn_struct_t *conn, struct sockaddr *addr, 87*74e20cfeSnh145002 socklen_t addrlen); 88*74e20cfeSnh145002 extern void sdp_close(struct sdp_conn_struct_t *conn); 89*74e20cfeSnh145002 extern int sdp_connect(struct sdp_conn_struct_t *conn, 90*74e20cfeSnh145002 const struct sockaddr *dst, socklen_t addrlen); 91*74e20cfeSnh145002 extern struct sdp_conn_struct_t *sdp_create(void *newhandle, 92*74e20cfeSnh145002 struct sdp_conn_struct_t *parent, int family, int flags, 93*74e20cfeSnh145002 const sdp_upcalls_t *su, sdp_sockbuf_limits_t *sbl, cred_t *cr, 94*74e20cfeSnh145002 int *error); 95*74e20cfeSnh145002 extern int sdp_disconnect(struct sdp_conn_struct_t *conn, int flags); 96*74e20cfeSnh145002 extern int sdp_shutdown(struct sdp_conn_struct_t *conn, int flag); 97*74e20cfeSnh145002 extern int sdp_polldata(struct sdp_conn_struct_t *conn, int flag); 98*74e20cfeSnh145002 extern int sdp_get_opt(struct sdp_conn_struct_t *conn, int level, int opt, 99*74e20cfeSnh145002 void *opts, socklen_t *optlen); 100*74e20cfeSnh145002 extern int sdp_getpeername(struct sdp_conn_struct_t *conn, 101*74e20cfeSnh145002 struct sockaddr *addr, socklen_t *addrlen); 102*74e20cfeSnh145002 extern int sdp_getsockname(struct sdp_conn_struct_t *conn, 103*74e20cfeSnh145002 struct sockaddr *addr, socklen_t *addrlen); 104*74e20cfeSnh145002 extern int sdp_itf_ver(int); 105*74e20cfeSnh145002 extern int sdp_listen(struct sdp_conn_struct_t *conn, int backlog); 106*74e20cfeSnh145002 extern int sdp_send(struct sdp_conn_struct_t *conn, struct msghdr *msg, 107*74e20cfeSnh145002 size_t size, int flags, struct uio *uiop); 108*74e20cfeSnh145002 extern int sdp_recv(struct sdp_conn_struct_t *conn, struct msghdr *msg, 109*74e20cfeSnh145002 size_t size, int flags, struct uio *uiop); 110*74e20cfeSnh145002 extern int sdp_set_opt(struct sdp_conn_struct_t *conn, int level, int opt, 111*74e20cfeSnh145002 const void *opts, socklen_t optlen); 112*74e20cfeSnh145002 extern int sdp_ioctl(struct sdp_conn_struct_t *conn, int cmd, int32_t *value, 113*74e20cfeSnh145002 struct cred *cr); 114*74e20cfeSnh145002 115*74e20cfeSnh145002 116*74e20cfeSnh145002 /* Flags for sdp_create() */ 117*74e20cfeSnh145002 #define SDP_CAN_BLOCK 0x01 118*74e20cfeSnh145002 119*74e20cfeSnh145002 #define SDP_READ 0x01 120*74e20cfeSnh145002 #define SDP_XMIT 0x02 121*74e20cfeSnh145002 122*74e20cfeSnh145002 #endif /* _KERNEL */ 123*74e20cfeSnh145002 124*74e20cfeSnh145002 #define SDP_NODELAY 0x01 125*74e20cfeSnh145002 126*74e20cfeSnh145002 #ifdef __cplusplus 127*74e20cfeSnh145002 } 128*74e20cfeSnh145002 #endif 129*74e20cfeSnh145002 130*74e20cfeSnh145002 #endif /* _INET_SDP_ITF_H */ 131