home *** CD-ROM | disk | FTP | other *** search
/ Network PC / Network PC.iso / amiga utilities / communication / internet / amitcp3.0b / src.lha / src / amitcp / netinet / in_pcb.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-08  |  4.6 KB  |  119 lines

  1. /*
  2.  * $Id: in_pcb.h,v 1.3 1993/03/03 21:51:28 jraja Exp $
  3.  *
  4.  * HISTORY
  5.  * $Log: in_pcb.h,v $
  6.  * Revision 1.3  1993/03/03  21:51:28  jraja
  7.  * Added #ifndef to prevent multiple inclusion.
  8.  *
  9.  * Revision 1.2  93/02/26  10:08:37  10:08:37  jraja (Jarno Tapio Rajahalme)
  10.  * Changed in_pcblookup prototype to ANSI C.
  11.  * 
  12.  * Revision 1.1  92/11/17  16:29:03  16:29:03  jraja (Jarno Tapio Rajahalme)
  13.  * Initial revision
  14.  * 
  15.  *
  16.  */
  17.  
  18. /*
  19.  * Copyright (c) 1982, 1986, 1990 Regents of the University of California.
  20.  * All rights reserved.
  21.  *
  22.  * Redistribution and use in source and binary forms, with or without
  23.  * modification, are permitted provided that the following conditions
  24.  * are met:
  25.  * 1. Redistributions of source code must retain the above copyright
  26.  *    notice, this list of conditions and the following disclaimer.
  27.  * 2. Redistributions in binary form must reproduce the above copyright
  28.  *    notice, this list of conditions and the following disclaimer in the
  29.  *    documentation and/or other materials provided with the distribution.
  30.  * 3. All advertising materials mentioning features or use of this software
  31.  *    must display the following acknowledgement:
  32.  *    This product includes software developed by the University of
  33.  *    California, Berkeley and its contributors.
  34.  * 4. Neither the name of the University nor the names of its contributors
  35.  *    may be used to endorse or promote products derived from this software
  36.  *    without specific prior written permission.
  37.  *
  38.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  39.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  40.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  41.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  42.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  43.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  44.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  45.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  46.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  47.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  48.  * SUCH DAMAGE.
  49.  *
  50.  *    @(#)in_pcb.h    7.6 (Berkeley) 6/28/90
  51.  */
  52.  
  53. #ifndef IN_PCB_H
  54. #define IN_PCB_H
  55.  
  56. /*
  57.  * Common structure pcb for internet protocol implementation.
  58.  * Here are stored pointers to local and foreign host table
  59.  * entries, local and foreign socket numbers, and pointers
  60.  * up (to a socket structure) and down (to a protocol-specific)
  61.  * control block.
  62.  */
  63. struct inpcb {
  64.     struct    inpcb *inp_next,*inp_prev;
  65.                     /* pointers to other pcb's */
  66.     struct    inpcb *inp_head;    /* pointer back to chain of inpcb's
  67.                        for this protocol */
  68.     struct    in_addr inp_faddr;    /* foreign host table entry */
  69.     u_short    inp_fport;        /* foreign port */
  70.     struct    in_addr inp_laddr;    /* local host table entry */
  71.     u_short    inp_lport;        /* local port */
  72.     struct    socket *inp_socket;    /* back pointer to socket */
  73.     caddr_t    inp_ppcb;        /* pointer to per-protocol pcb */
  74.     struct    route inp_route;    /* placeholder for routing entry */
  75.     int    inp_flags;        /* generic IP/datagram flags */
  76.     struct    ip inp_ip;        /* header prototype; should have more */
  77.     struct    mbuf *inp_options;    /* IP options */
  78. };
  79.  
  80. /* flags in inp_flags: */
  81. #define    INP_RECVOPTS        0x01    /* receive incoming IP options */
  82. #define    INP_RECVRETOPTS        0x02    /* receive IP options for reply */
  83. #define    INP_RECVDSTADDR        0x04    /* receive IP dst address */
  84. #define    INP_CONTROLOPTS        (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR)
  85.  
  86. #ifdef sotorawcb        /* defined in net/raw_cb.h */
  87. /*
  88.  * Common structure pcb for raw internet protocol access.
  89.  * Here are internet specific extensions to the raw control block,
  90.  * and space is allocated to the necessary sockaddrs.
  91.  */
  92. struct raw_inpcb {
  93.     struct    rawcb rinp_rcb;    /* common control block prefix */
  94.     struct    mbuf *rinp_options;    /* IP options */
  95.     int    rinp_flags;        /* flags, e.g. raw sockopts */
  96. #define    RINPF_HDRINCL    0x1        /* user supplies entire IP header */
  97.     struct    sockaddr_in rinp_faddr;    /* foreign address */
  98.     struct    sockaddr_in rinp_laddr;    /* local address */
  99.     struct    route rinp_route;    /* placeholder for routing entry */
  100. };
  101. #endif
  102.  
  103. #define    INPLOOKUP_WILDCARD    1
  104. #define    INPLOOKUP_SETLOCAL    2
  105.  
  106. #define    sotoinpcb(so)    ((struct inpcb *)(so)->so_pcb)
  107. #define    sotorawinpcb(so)    ((struct raw_inpcb *)(so)->so_pcb)
  108.  
  109. #ifdef KERNEL
  110. struct inpcb * in_pcblookup(struct inpcb * head,
  111.                             struct in_addr faddr,
  112.                             u_short fport,
  113.                             struct in_addr laddr,
  114.                             u_short lport,
  115.                 int flags);
  116. #endif
  117.  
  118. #endif /* !IN_PCB_H */
  119.