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

VxWorks

开发平台:

C/C++

  1. /* raw_cb.h - raw protocol interface control block header file */
  2. /* Copyright 1984 - 2001 Wind River Systems, Inc. */
  3. /*
  4.  * Copyright (c) 1980, 1986, 1993
  5.  * The Regents of the University of California.  All rights reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  * 1. Redistributions of source code must retain the above copyright
  11.  *    notice, this list of conditions and the following disclaimer.
  12.  * 2. Redistributions in binary form must reproduce the above copyright
  13.  *    notice, this list of conditions and the following disclaimer in the
  14.  *    documentation and/or other materials provided with the distribution.
  15.  * 3. All advertising materials mentioning features or use of this software
  16.  *    must display the following acknowledgement:
  17.  * This product includes software developed by the University of
  18.  * California, Berkeley and its contributors.
  19.  * 4. Neither the name of the University nor the names of its contributors
  20.  *    may be used to endorse or promote products derived from this software
  21.  *    without specific prior written permission.
  22.  *
  23.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  24.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  25.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  26.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  27.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  28.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  29.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  30.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  31.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  32.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  33.  * SUCH DAMAGE.
  34.  *
  35.  * @(#)raw_cb.h 8.1 (Berkeley) 6/10/93
  36.  */
  37. /*
  38. modification history
  39. --------------------
  40. 03c,10oct01,rae  merge from truestack (VIRTUAL_STACK)
  41. 03b,31jan97,vin  changed declaration according to prototype decl in protosw.h
  42. 03a,03mar96,vin  created from BSD4.4 stuff,integrated with 02i of raw_cb.h
  43. 02i,22sep92,rrr  added support for c++
  44. 02h,26may92,rrr  the tree shuffle
  45. 02g,28feb92,wmd  changed last pragma to turn off alignment 1.
  46. 02f,04oct91,rrr  passed through the ansification filter
  47.   -fixed #else and #endif
  48.   -changed copyright notice
  49. 02e,10jun91.del  added pragma for gnu960 alignment.
  50. 02d,05oct90,shl  added copyright notice.
  51.                  made #endif ANSI style.
  52. 02c,16apr89,gae  updated to new 4.3BSD.
  53. 02b,04nov87,dnw  moved rawcb definition to raw_cb.c.
  54. 02a,03apr87,ecs  added header and copyright.
  55. */
  56. #ifndef __INCraw_cbh
  57. #define __INCraw_cbh
  58. #ifdef __cplusplus
  59. extern "C" {
  60. #endif
  61. #if ((CPU_FAMILY==I960) && (defined __GNUC__))
  62. #pragma align 1                 /* tell gcc960 not to optimize alignments */
  63. #endif /* CPU_FAMILY==I960 */
  64. /*
  65.  * Raw protocol interface control block.  Used
  66.  * to tie a socket to the generic raw interface.
  67.  */
  68. struct rawcb {
  69. struct rawcb *rcb_next; /* doubly linked list */
  70. struct rawcb *rcb_prev;
  71. struct socket *rcb_socket; /* back pointer to socket */
  72. struct sockaddr *rcb_faddr; /* destination address */
  73. struct sockaddr *rcb_laddr; /* socket's address */
  74. struct sockproto rcb_proto; /* protocol family, protocol */
  75. };
  76. #if ((CPU_FAMILY==I960) && (defined __GNUC__))
  77. #pragma align 0                 /* turn off alignment requirement */
  78. #endif  /* CPU_FAMILY==I960 */
  79. #define sotorawcb(so) ((struct rawcb *)(so)->so_pcb)
  80. /*
  81.  * Nominal space allocated to a raw socket.
  82.  */
  83. #define RAWSNDQ 8192
  84. #define RAWRCVQ 8192
  85. #ifndef VIRTUAL_STACK
  86. extern  struct rawcb rawcb; /* head of list */
  87. #endif
  88. extern int  raw_attach (struct socket *, int);
  89. extern void  raw_ctlinput (int, struct sockaddr *);
  90. extern void  raw_detach (struct rawcb *);
  91. extern void  raw_disconnect (struct rawcb *);
  92. extern void  raw_init (void);
  93. extern void  raw_input (struct mbuf *, struct sockproto *, 
  94.     struct sockaddr *, struct sockaddr *);
  95. extern int  raw_usrreq (struct socket *, int, struct mbuf *, 
  96.      struct mbuf *, struct mbuf *);
  97. #ifdef __cplusplus
  98. }
  99. #endif
  100. #endif /* __INCraw_cbh */