home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 4 / hacker04 / 04_HACK04.ISO / darwin / darwinx86.iso / usr / include / netinet6 / natpt_log.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-09-30  |  3.3 KB  |  130 lines

  1. /*    $KAME: natpt_log.h,v 1.5 2000/03/25 07:23:55 sumikawa Exp $    */
  2.  
  3. /*
  4.  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
  5.  * 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. Neither the name of the project nor the names of its contributors
  16.  *    may be used to endorse or promote products derived from this software
  17.  *    without specific prior written permission.
  18.  *
  19.  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
  20.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  22.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
  23.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  24.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  25.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  26.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  27.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  28.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  29.  * SUCH DAMAGE.
  30.  */
  31.  
  32. #ifndef _NATPT_LOG_H
  33. #define    _NATPT_LOG_H
  34.  
  35.  
  36. #if (defined(KERNEL)) || (defined(_KERNEL))
  37.  
  38. /*  Header at beginning of logged packet.                */
  39.  
  40. struct    l_pkt
  41. {
  42.     char    ifName[IFNAMSIZ];
  43.     char    __buf[4];
  44. };
  45.  
  46.  
  47. /*  Header at beginning of active Transration Table            */
  48.  
  49. struct    l_att
  50. {
  51.     u_int        _stub;
  52. #define    ATT_ALLOC    (0)
  53. #define    ATT_REMOVE    (1)
  54. #define    ATT_FASTEN    (2)
  55. #define    ATT_UNFASTEN    (3)
  56. #define    ATT_REGIST    (4)
  57.     caddr_t        _addr;
  58. #if    0
  59.     struct  _aTT    _att;
  60.     struct  _tcpstate    _state;
  61. #endif
  62. };
  63. #endif    /* defined(KERNEL)    */
  64.  
  65.  
  66. /*  Header at beginning of each lbuf.                    */
  67.  
  68. #ifndef IN6ADDRSZ
  69. #define    IN6ADDRSZ        16    /* IPv6 T_AAAA */
  70. #define    INT16SZ            2    /* for systems without 16-bit ints    */
  71. #endif    /* !defined(IN6ADDRSZ)    */
  72.  
  73. #define    LBFSZ    (MHLEN - sizeof(struct l_hdr))    /* LBUF payload within MBUF    */
  74. #define    MSGSZ    (LBFSZ    - IN6ADDRSZ)        /* max message size    */
  75.  
  76.  
  77. enum
  78. {
  79.     LOG_MSG,
  80.     LOG_MBUF,
  81.     LOG_IP4,
  82.     LOG_IP6,
  83.     LOG_IN4ADDR,
  84.     LOG_IN6ADDR,
  85.     LOG_CSLOT,
  86.     LOG_TSLOT,
  87.     LOG_RULE
  88. };
  89.  
  90.  
  91. struct    l_hdr
  92. {
  93.     u_short     lh_type;    /* Type of data in this lbuf        */
  94.     u_short     lh_pri;    /* Priorities of thie message        */
  95.     size_t     lh_size;    /* Amount of data in this lbuf        */
  96.     u_long     lh_sec;    /* Timestamp in second            */
  97.     u_long     lh_usec;    /* Timestamp in microsecond        */
  98. };
  99.  
  100.  
  101. struct    l_addr
  102. {
  103.     char    in6addr[IN6ADDRSZ];
  104.     char    __msg[MSGSZ];
  105. };
  106.  
  107.  
  108. /*  Definition of whole lbuf                        */
  109.  
  110. struct    lbuf
  111. {
  112.     struct    l_hdr    l_hdr;
  113.     union
  114.     {
  115. #ifdef _KERNEL
  116.     struct    l_pkt    l_pkt;
  117.     struct    l_att    l_att;
  118. #endif    /* defined(_KERNEL)    */
  119.     struct    l_addr    __laddr;
  120.     char        __buf[LBFSZ];
  121.     }        l_dat;
  122. };
  123.  
  124.  
  125. #define    l_addr        l_dat.__laddr
  126. #define    l_msg        l_dat.__laddr.__msg
  127.  
  128.  
  129. #endif    /* !_NATPT_LOG_H    */
  130.