netLib.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:9k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* netLib.h - header file for netLib.c */
  2. /* Copyright 1984-2001 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01n,10oct01,rae  merge from truestack ver 01q base 01m
  7. 01m,24mar99,ann  protected some #defines within #ifndefs to avoid conflicts
  8.                  in project tool. (only for those defined in 00network.cdf)
  9. 01l,01jul97,vin  added routeSockLibInit().
  10. 01k,17apr97,vin  added ipFilterLibInit().
  11. 01i,08apr97,vin  added mCastRouteLibInit().
  12. 01j,31jan97,vin  added default configuration macros.
  13. 01h,20jan97,vin  added declarations for protocol initialization functions,
  14.                  added configuration parameters, added interrupt masks.
  15. 01g,26aug96,vin  added new declaration for schednetisr().
  16. 01f,22sep92,rrr  added support for c++
  17. 01e,04jul92,jcf  cleaned up.
  18. 01d,26may92,rrr  the tree shuffle
  19. 01c,04oct91,rrr  passed through the ansification filter
  20.                   -fixed #else and #endif
  21.                   -changed VOID to void
  22.                   -changed copyright notice
  23. 01b,05oct90,dnw deleted private routine.
  24. 01a,05oct90,shl created.
  25. */
  26. #ifndef __INCnetLibh
  27. #define __INCnetLibh
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. /* wrs specific network isr codes */
  32. #define NETISR_IP       1               /* for IP packets */
  33. #define NETISR_ARP      2               /* for arp packets */
  34. #define NETISR_RARP     3               /* for rarp packets */
  35. #define NETISR_IMP      4               /* same as AF_IMPLINK */
  36. #define NETISR_NS       5               /* same as AF_NS */
  37. #define NETISR_ISO      6               /* same as AF_ISO */
  38. #define NETISR_CCITT    7               /* same as AF_CCITT */
  39. /* wrs network isr masks */
  40. #define IP_INTR_MASK    (1 << NETISR_IP)
  41. #define ARP_INTR_MASK   (1 << NETISR_ARP)
  42. #define RARP_INTR_MASK  (1 << NETISR_RARP)
  43. #define IMP_INTR_MASK   (1 << NETISR_IMP)
  44. #define NS_INTR_MASK    (1 << NETISR_NS)
  45. #define ISO_INTR_MASK   (1 << NETISR_ISO)
  46. #define CCITT_INTR_MASK (1 << NETISR_CCITT)
  47. #if ((CPU_FAMILY==I960) && (defined __GNUC__))
  48. #pragma align 1                 /* tell gcc960 not to optimize alignments */
  49. #endif  /* CPU_FAMILY==I960 */
  50. /* ip configuration parameters */
  51. typedef struct ipcfgparams
  52.     {
  53.     int         ipCfgFlags;             /* ip configuration flags */
  54.     int         ipDefTtl;               /* ip packet default time to live */
  55.     int         ipIntrQueueLen;         /* ip interrupt queue length */
  56.     int         ipFragTtl;              /* ip fragment time to live */
  57.     } IP_CFG_PARAMS;
  58. /* icmp configuration parameters */
  59. typedef struct icmpcfgparams
  60.     {
  61.     int         icmpCfgFlags;           /* icmp configuration flags */
  62.     } ICMP_CFG_PARAMS;
  63. /* udp configuration parameters */
  64. typedef struct udpcfgparams
  65.     {
  66.     int         udpCfgFlags;            /* udp configuration flags */
  67.     int         udpSndSpace;            /* udp send space */
  68.     int         udpRcvSpace;            /* udp receive space */
  69.     } UDP_CFG_PARAMS;
  70. /* tcp configuration parameters */
  71. typedef struct tcpcfgparams
  72.     {
  73.     int         tcpCfgFlags;            /* tcp configuration flags */
  74.     int         tcpSndSpace;            /* tcp send space */
  75.     int         tcpRcvSpace;            /* tcp receive space */
  76.     int         tcpConnectTime;         /* tcp connect time out */
  77.     int         tcpReTxThresh;          /* tcp no. dup ACK to trig fast reTx */
  78.     int         tcpMssDflt;             /* tcp default maximum segment size */
  79.     int         tcpRttDflt;             /* tcp default RTT if no data */
  80.     int         tcpKeepIdle;            /* tcp idle time before first probe */
  81.     int         tcpKeepCnt;             /* tcp max probes before dropping */
  82.     FUNCPTR pTcpRandFunc; /* tcp random function for tcp_init */
  83.     } TCP_CFG_PARAMS;
  84. #if ((CPU_FAMILY==I960) && (defined __GNUC__))
  85. #pragma align 0                 /* turn off alignment requirement */
  86. #endif  /* CPU_FAMILY==I960 */
  87. #define IP_PROTO_NUM_MAX        16       /* maximum size of protocol switch */
  88. /* ip configuration defines */
  89. #define IP_NO_FORWARDING        0x000000000     /* no ip forwarding of pkts */
  90. #define IP_DO_FORWARDING        0x000000001     /* do ip forwarding of pkts */
  91. #define IP_DO_REDIRECT          0x000000002     /* do ip redirecting of pkts */
  92. #define IP_DO_LARGE_BCAST       0x000000004     /* do broadcasting pkt > MTU */
  93. #define IP_DO_CHECKSUM_SND      0x000000008     /* calculate ip checksum */
  94. #define IP_DO_CHECKSUM_RCV      0x000000010
  95. /* default ip configurations */
  96. #ifndef IP_FLAGS_DFLT
  97. #define IP_FLAGS_DFLT           (IP_DO_FORWARDING | IP_DO_REDIRECT | 
  98.                                  IP_DO_CHECKSUM_SND | IP_DO_CHECKSUM_RCV)
  99. #endif  /* IP_FLAGS_DFLT */
  100. #ifndef IP_TTL_DFLT
  101. #define IP_TTL_DFLT             64              /* default ip queue length */
  102. #endif  /* IP_TTL_DFLT */
  103. #ifndef IP_QLEN_DFLT
  104. #define IP_QLEN_DFLT            50
  105. #endif  /* IP_QLEN_DFLT */
  106. #ifndef IP_FRAG_TTL_DFLT
  107. #define IP_FRAG_TTL_DFLT        60              /* 60 slow time outs, 30secs */
  108. #endif  /* IP_FRAG_TTL_DFLT */
  109. /* udp configuration defines */
  110. #define UDP_DO_NO_CKSUM         0x00000000
  111. #define UDP_DO_CKSUM_SND        0x00000001      /* do check sum on sends */
  112. #define UDP_DO_CKSUM_RCV        0x00000002      /* do check sum on recvs */
  113. /* default udp configurations */
  114. #ifndef UDP_FLAGS_DFLT
  115. #define UDP_FLAGS_DFLT          (UDP_DO_CKSUM_SND | UDP_DO_CKSUM_RCV)
  116. #endif  /* UDP_FLAGS_DFLT */
  117. #ifndef UDP_SND_SIZE_DFLT
  118. #define UDP_SND_SIZE_DFLT       9216            /* default send buffer size */
  119. #endif  /* UDP_SND_SIZE_DFLT */
  120. #ifndef UDP_RCV_SIZE_DFLT
  121. #define UDP_RCV_SIZE_DFLT       41600           /* default recv buffer size */
  122. #endif  /* UDP_RCV_SIZE_DFLT */
  123. /* tcp configuration defines */
  124. #define TCP_NO_RFC1323          0x00000000      /* tcp no RFC 1323 support */
  125. #define TCP_DO_RFC1323          0x00000001      /* tcp RFC 1323 support*/
  126. /* default tcp configurations */
  127. #ifndef TCP_FLAGS_DFLT
  128. #define TCP_FLAGS_DFLT          (TCP_DO_RFC1323)
  129. #endif  /* TCP_FLAGS_DFLT */
  130. #ifndef TCP_SND_SIZE_DFLT
  131. #define TCP_SND_SIZE_DFLT       8192            /* default send buffer size */
  132. #endif  /* TCP_SND_SIZE_DFLT */
  133. #ifndef TCP_RCV_SIZE_DFLT
  134. #define TCP_RCV_SIZE_DFLT       8192            /* default recv buffer size */
  135. #endif  /* TCP_RCV_SIZE_DFLT */
  136. #ifndef TCP_CON_TIMEO_DFLT
  137. #define TCP_CON_TIMEO_DFLT      150             /* 75 secs */
  138. #endif  /* TCP_CON_TIMEO_DFLT */
  139. #ifndef TCP_REXMT_THLD_DFLT
  140. #define TCP_REXMT_THLD_DFLT     3               /* 3 times */
  141. #endif  /* TCP_REXMT_THLD_DFLT */
  142. #ifndef TCP_MSS_DFLT
  143. #define TCP_MSS_DFLT            512             /* default max segment size */
  144. #endif  /* TCP_MSS_DFLT */
  145. #ifndef TCP_RND_TRIP_DFLT
  146. #define TCP_RND_TRIP_DFLT       3               /* 3 secs if no data avail */
  147. #endif  /* TCP_RND_TRIP_DFLT */
  148. #ifndef TCP_IDLE_TIMEO_DFLT
  149. #define TCP_IDLE_TIMEO_DFLT     14400           /* idle timeouts, 2 hrs */
  150. #endif  /* TCP_IDLE_TIMEO_DFLT */
  151. #ifndef TCP_MAX_PROBE_DFLT
  152. #define TCP_MAX_PROBE_DFLT      8               /* probes before dropping */
  153. #endif  /* TCP_MAX_PROBE_DFLT */
  154. /* icmp configuration defines */
  155. #define ICMP_NO_MASK_REPLY      0x000000000     /* no mask reply support */
  156. #define ICMP_DO_MASK_REPLY      0x000000001     /* do icmp mask reply */
  157. /* default icmp configurations */
  158. #ifndef ICMP_FLAGS_DFLT
  159. #define ICMP_FLAGS_DFLT         (ICMP_NO_MASK_REPLY)
  160. #endif  /* ICMP_FLAGS_DFLT */
  161. /* function declarations */
  162. #if defined(__STDC__) || defined(__cplusplus)
  163. extern STATUS   netJobAdd (FUNCPTR routine, int param1, int param2, int param3,
  164.                            int param4, int param5);
  165. extern STATUS   netLibInit (void);
  166. extern void     netErrnoSet (int status);
  167. extern void netLibGeneralInit (void);
  168. extern void     netTask (void);
  169. extern void     schednetisr (int isrType);
  170. extern STATUS   ipLibInit (IP_CFG_PARAMS * ipCfg);
  171. extern STATUS   rawIpLibInit (void);
  172. extern STATUS   rawLibInit (void);
  173. extern STATUS   udpLibInit (UDP_CFG_PARAMS * udpCfg);
  174. extern STATUS   tcpLibInit (TCP_CFG_PARAMS * tcpCfg);
  175. extern STATUS   icmpLibInit (ICMP_CFG_PARAMS * icmpCfg);
  176. extern STATUS   igmpLibInit (void);
  177. extern STATUS   mCastRouteLibInit (void);
  178. extern void     ipFilterLibInit (void);
  179. extern STATUS   routeSockLibInit (void);
  180. extern void     splSemInit (void);
  181. extern void     mbinit (void);
  182. extern void     domaininit (void);
  183. #else   /* __STDC__ */
  184. extern STATUS   netJobAdd ();
  185. extern STATUS   netLibInit ();
  186. extern void     netErrnoSet ();
  187. extern void netLibGeneralInit ();
  188. extern void     netTask ();
  189. extern void     schednetisr ();
  190. extern STATUS   ipLibInit ();
  191. extern STATUS   rawIpLibInit ();
  192. extern STATUS   rawLibInit ();
  193. extern STATUS   udpLibInit ();
  194. extern STATUS   tcpLibInit ();
  195. extern STATUS   icmpLibInit ();
  196. extern STATUS   igmpLibInit ();
  197. extern STATUS   mCastRouteLibInit ();
  198. extern void     ipFilterLibInit ();
  199. extern STATUS   routeSockLibInit ();
  200. extern void     splSemInit ();
  201. extern void     mbinit ();
  202. extern void     domaininit ();
  203. #endif  /* __STDC__ */
  204. #ifdef __cplusplus
  205. }
  206. #endif
  207. #endif /* __INCnetLibh */