Print this page
some functions in the tcp module can be static


  25 
  26 #include <sys/types.h>
  27 #include <sys/stream.h>
  28 #define _SUN_TPI_VERSION 2
  29 #include <sys/tihdr.h>
  30 #include <sys/socket.h>
  31 #include <sys/xti_xtiopt.h>
  32 #include <sys/xti_inet.h>
  33 #include <sys/policy.h>
  34 
  35 #include <inet/common.h>
  36 #include <netinet/ip6.h>
  37 #include <inet/ip.h>
  38 
  39 #include <netinet/in.h>
  40 #include <netinet/tcp.h>
  41 #include <inet/optcom.h>
  42 #include <inet/proto_set.h>
  43 #include <inet/tcp_impl.h>
  44 


  45 /*
  46  * Table of all known options handled on a TCP protocol stack.
  47  *
  48  * Note: This table contains options processed by both TCP and IP levels
  49  *       and is the superset of options that can be performed on a TCP over IP
  50  *       stack.
  51  */
  52 opdes_t tcp_opt_arr[] = {
  53 
  54 { SO_LINGER,    SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0,
  55         sizeof (struct linger), 0 },
  56 
  57 { SO_DEBUG,     SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
  58 { SO_KEEPALIVE, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
  59 { SO_DONTROUTE, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
  60 { SO_USELOOPBACK, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0
  61         },
  62 { SO_BROADCAST, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
  63 { SO_REUSEADDR, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
  64 { SO_OOBINLINE, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },


 289         switch (level) {
 290         case IPPROTO_TCP:
 291                 switch (name) {
 292                 case TCP_NODELAY:
 293                         return (B_TRUE);
 294                 default:
 295                         return (B_FALSE);
 296                 }
 297                 /*NOTREACHED*/
 298         default:
 299                 return (B_FALSE);
 300         }
 301         /*NOTREACHED*/
 302 }
 303 
 304 /*
 305  * This routine gets default values of certain options whose default
 306  * values are maintained by protocol specific code
 307  */
 308 /* ARGSUSED */
 309 int
 310 tcp_opt_default(queue_t *q, int level, int name, uchar_t *ptr)
 311 {
 312         int32_t *i1 = (int32_t *)ptr;
 313         tcp_stack_t     *tcps = Q_TO_TCP(q)->tcp_tcps;
 314 
 315         switch (level) {
 316         case IPPROTO_TCP:
 317                 switch (name) {
 318                 case TCP_NOTIFY_THRESHOLD:
 319                         *i1 = tcps->tcps_ip_notify_interval;
 320                         break;
 321                 case TCP_ABORT_THRESHOLD:
 322                         *i1 = tcps->tcps_ip_abort_interval;
 323                         break;
 324                 case TCP_CONN_NOTIFY_THRESHOLD:
 325                         *i1 = tcps->tcps_ip_notify_cinterval;
 326                         break;
 327                 case TCP_CONN_ABORT_THRESHOLD:
 328                         *i1 = tcps->tcps_ip_abort_cinterval;
 329                         break;




  25 
  26 #include <sys/types.h>
  27 #include <sys/stream.h>
  28 #define _SUN_TPI_VERSION 2
  29 #include <sys/tihdr.h>
  30 #include <sys/socket.h>
  31 #include <sys/xti_xtiopt.h>
  32 #include <sys/xti_inet.h>
  33 #include <sys/policy.h>
  34 
  35 #include <inet/common.h>
  36 #include <netinet/ip6.h>
  37 #include <inet/ip.h>
  38 
  39 #include <netinet/in.h>
  40 #include <netinet/tcp.h>
  41 #include <inet/optcom.h>
  42 #include <inet/proto_set.h>
  43 #include <inet/tcp_impl.h>
  44 
  45 static int      tcp_opt_default(queue_t *, int, int, uchar_t *);
  46 
  47 /*
  48  * Table of all known options handled on a TCP protocol stack.
  49  *
  50  * Note: This table contains options processed by both TCP and IP levels
  51  *       and is the superset of options that can be performed on a TCP over IP
  52  *       stack.
  53  */
  54 opdes_t tcp_opt_arr[] = {
  55 
  56 { SO_LINGER,    SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0,
  57         sizeof (struct linger), 0 },
  58 
  59 { SO_DEBUG,     SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
  60 { SO_KEEPALIVE, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
  61 { SO_DONTROUTE, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
  62 { SO_USELOOPBACK, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0
  63         },
  64 { SO_BROADCAST, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
  65 { SO_REUSEADDR, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
  66 { SO_OOBINLINE, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },


 291         switch (level) {
 292         case IPPROTO_TCP:
 293                 switch (name) {
 294                 case TCP_NODELAY:
 295                         return (B_TRUE);
 296                 default:
 297                         return (B_FALSE);
 298                 }
 299                 /*NOTREACHED*/
 300         default:
 301                 return (B_FALSE);
 302         }
 303         /*NOTREACHED*/
 304 }
 305 
 306 /*
 307  * This routine gets default values of certain options whose default
 308  * values are maintained by protocol specific code
 309  */
 310 /* ARGSUSED */
 311 static int
 312 tcp_opt_default(queue_t *q, int level, int name, uchar_t *ptr)
 313 {
 314         int32_t *i1 = (int32_t *)ptr;
 315         tcp_stack_t     *tcps = Q_TO_TCP(q)->tcp_tcps;
 316 
 317         switch (level) {
 318         case IPPROTO_TCP:
 319                 switch (name) {
 320                 case TCP_NOTIFY_THRESHOLD:
 321                         *i1 = tcps->tcps_ip_notify_interval;
 322                         break;
 323                 case TCP_ABORT_THRESHOLD:
 324                         *i1 = tcps->tcps_ip_abort_interval;
 325                         break;
 326                 case TCP_CONN_NOTIFY_THRESHOLD:
 327                         *i1 = tcps->tcps_ip_notify_cinterval;
 328                         break;
 329                 case TCP_CONN_ABORT_THRESHOLD:
 330                         *i1 = tcps->tcps_ip_abort_cinterval;
 331                         break;