1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _IDM_SO_H 27 #define _IDM_SO_H 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 #include <sys/idm/idm_transport.h> 34 35 /* 36 * Define TCP window size (send and receive buffer sizes) 37 */ 38 39 #define IDM_RCVBUF_SIZE (256 * 1024) 40 #define IDM_SNDBUF_SIZE (256 * 1024) 41 42 /* sockets-specific portion of idm_svc_t */ 43 typedef struct idm_so_svc_s { 44 struct sonode *is_so; 45 kthread_t *is_thread; 46 kt_did_t is_thread_did; 47 boolean_t is_thread_running; 48 } idm_so_svc_t; 49 50 /* sockets-specific portion of idm_conn_t */ 51 typedef struct idm_so_conn_s { 52 struct sonode *ic_so; 53 54 kthread_t *ic_tx_thread; 55 kt_did_t ic_tx_thread_did; 56 boolean_t ic_tx_thread_running; 57 kmutex_t ic_tx_mutex; 58 kcondvar_t ic_tx_cv; 59 list_t ic_tx_list; /* List of PDUs for transmit */ 60 61 kthread_t *ic_rx_thread; 62 kt_did_t ic_rx_thread_did; 63 boolean_t ic_rx_thread_running; 64 } idm_so_conn_t; 65 66 void idm_so_init(idm_transport_t *it); 67 void idm_so_fini(); 68 69 /* Socket functions */ 70 71 struct sonode * 72 idm_socreate(int domain, int type, int protocol); 73 74 void idm_soshutdown(struct sonode *so); 75 76 void idm_sodestroy(struct sonode *so); 77 78 int idm_get_ipaddr(idm_addr_list_t **); 79 80 int idm_sorecv(struct sonode *so, void *msg, size_t len); 81 82 int idm_sosendto(struct sonode *so, void *buff, size_t len, 83 struct sockaddr *name, socklen_t namelen); 84 85 int idm_iov_sosend(struct sonode *so, iovec_t *iop, int iovlen, 86 size_t total_len); 87 88 int idm_iov_sorecv(struct sonode *so, iovec_t *iop, int iovlen, 89 size_t total_len); 90 91 void idm_sotx_thread(void *arg); 92 void idm_sorx_thread(void *arg); 93 94 95 int idm_sotx_pdu_constructor(void *hdl, void *arg, int flags); 96 97 void idm_sotx_pdu_destructor(void *pdu_void, void *arg); 98 99 int idm_sorx_pdu_constructor(void *hdl, void *arg, int flags); 100 101 void idm_sorx_pdu_destructor(void *pdu_void, void *arg); 102 103 void idm_so_svc_port_watcher(void *arg); 104 105 106 #ifdef __cplusplus 107 } 108 #endif 109 110 #endif /* _IDM_SO_H */ 111