The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/netinet/ip_compat.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (C) 1993-1997 by Darren Reed.
    3  *
    4  * Redistribution and use in source and binary forms are permitted
    5  * provided that this notice is preserved and due credit is given
    6  * to the original author and the contributors.
    7  *
    8  * @(#)ip_compat.h      1.8 1/14/96
    9  * $FreeBSD$
   10  */
   11 
   12 #ifndef __IP_COMPAT_H__
   13 #define __IP_COMPAT_H__
   14 
   15 #ifndef __P
   16 # ifdef __STDC__
   17 #  define       __P(x)  x
   18 # else
   19 #  define       __P(x)  ()
   20 #  define       const
   21 # endif
   22 #endif
   23 
   24 #ifndef SOLARIS
   25 #define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
   26 #endif
   27 
   28 #if defined(_KERNEL) && !defined(KERNEL)
   29 # define        KERNEL
   30 #endif
   31 #if defined(KERNEL) && !defined(_KERNEL)
   32 # define        _KERNEL
   33 #endif
   34 #if!defined(__KERNEL__) && defined(KERNEL)
   35 # define        __KERNEL__
   36 #endif
   37 
   38 #if defined(__SVR4) || defined(__svr4__) || defined(__sgi)
   39 #define index   strchr
   40 # if !defined(_KERNEL)
   41 #  define       bzero(a,b)      memset(a,0,b)
   42 #  define       bcmp            memcmp
   43 #  define       bcopy(a,b,c)    memmove(b,a,c)
   44 # endif
   45 #endif
   46 
   47 #if defined(__sgi) || defined(bsdi)
   48 struct  ether_addr {
   49         u_char  ether_addr_octet[6];
   50 };
   51 #endif
   52 
   53 #if defined(__sgi) && !defined(IPFILTER_LKM)
   54 # ifdef __STDC__
   55 #  define IPL_EXTERN(ep) ipfilter##ep
   56 # else
   57 #  define IPL_EXTERN(ep) ipfilter/**/ep
   58 # endif
   59 #else
   60 # ifdef __STDC__
   61 #  define IPL_EXTERN(ep) ipl##ep
   62 # else
   63 #  define IPL_EXTERN(ep) ipl/**/ep
   64 # endif
   65 #endif
   66 
   67 #ifdef  linux
   68 # include <sys/sysmacros.h>
   69 #endif
   70 #if     SOLARIS
   71 # define        MTYPE(m)        ((m)->b_datap->db_type)
   72 # include       <sys/ioccom.h>
   73 # include       <sys/sysmacros.h>
   74 # include       <sys/kmem.h>
   75 /*
   76  * because Solaris 2 defines these in two places :-/
   77  */
   78 # undef IPOPT_EOL
   79 # undef IPOPT_NOP
   80 # undef IPOPT_LSRR
   81 # undef IPOPT_RR
   82 # undef IPOPT_SSRR
   83 # ifndef        _KERNEL
   84 #  define       _KERNEL
   85 #  undef        RES_INIT
   86 #  include <inet/common.h>
   87 #  include <inet/ip.h>
   88 #  include <inet/ip_ire.h>
   89 #  undef        _KERNEL
   90 # else /* _KERNEL */
   91 #  include <inet/common.h>
   92 #  include <inet/ip.h>
   93 #  include <inet/ip_ire.h>
   94 # endif /* _KERNEL */
   95 #endif /* SOLARIS */
   96 #define IPMINLEN(i, h)  ((i)->ip_len >= ((i)->ip_hl * 4 + sizeof(struct h)))
   97 
   98 #ifndef IP_OFFMASK
   99 #define IP_OFFMASK      0x1fff
  100 #endif
  101 
  102 #if     BSD > 199306
  103 # define        USE_QUAD_T
  104 # define        U_QUAD_T        u_quad_t
  105 # define        QUAD_T          quad_t
  106 #else /* BSD > 199306 */
  107 # define        U_QUAD_T        u_long
  108 # define        QUAD_T          long
  109 #endif /* BSD > 199306 */
  110 
  111 /*
  112  * These operating systems already take care of the problem for us.
  113  */
  114 #if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || \
  115     defined(__sgi)
  116 typedef u_int32_t       u_32_t;
  117 #else
  118 /*
  119  * Really, any arch where sizeof(long) != sizeof(int).
  120  */
  121 # if defined(__alpha__) || defined(__alpha)
  122 typedef unsigned int    u_32_t;
  123 # else
  124 typedef unsigned long   u_32_t;
  125 # endif
  126 #endif /* __NetBSD__ || __OpenBSD__ || __FreeBSD__ || __sgi */
  127 
  128 #ifndef MAX
  129 #define MAX(a,b)        (((a) > (b)) ? (a) : (b))
  130 #endif
  131 
  132 /*
  133  * Security Options for Intenet Protocol (IPSO) as defined in RFC 1108.
  134  *
  135  * Basic Option
  136  *
  137  * 00000001   -   (Reserved 4)
  138  * 00111101   -   Top Secret
  139  * 01011010   -   Secret
  140  * 10010110   -   Confidential
  141  * 01100110   -   (Reserved 3)
  142  * 11001100   -   (Reserved 2)
  143  * 10101011   -   Unclassified
  144  * 11110001   -   (Reserved 1)
  145  */
  146 #define IPSO_CLASS_RES4         0x01
  147 #define IPSO_CLASS_TOPS         0x3d
  148 #define IPSO_CLASS_SECR         0x5a
  149 #define IPSO_CLASS_CONF         0x96
  150 #define IPSO_CLASS_RES3         0x66
  151 #define IPSO_CLASS_RES2         0xcc
  152 #define IPSO_CLASS_UNCL         0xab
  153 #define IPSO_CLASS_RES1         0xf1
  154 
  155 #define IPSO_AUTH_GENSER        0x80
  156 #define IPSO_AUTH_ESI           0x40
  157 #define IPSO_AUTH_SCI           0x20
  158 #define IPSO_AUTH_NSA           0x10
  159 #define IPSO_AUTH_DOE           0x08
  160 #define IPSO_AUTH_UN            0x06
  161 #define IPSO_AUTH_FTE           0x01
  162 
  163 /*
  164  * IP option #defines
  165  */
  166 /*#define       IPOPT_RR        7 */
  167 #define IPOPT_ZSU       10      /* ZSU */
  168 #define IPOPT_MTUP      11      /* MTUP */
  169 #define IPOPT_MTUR      12      /* MTUR */
  170 #define IPOPT_ENCODE    15      /* ENCODE */
  171 /*#define       IPOPT_TS        68 */
  172 #define IPOPT_TR        82      /* TR */
  173 /*#define       IPOPT_SECURITY  130 */
  174 /*#define       IPOPT_LSRR      131 */
  175 #define IPOPT_E_SEC     133     /* E-SEC */
  176 #define IPOPT_CIPSO     134     /* CIPSO */
  177 /*#define       IPOPT_SATID     136 */
  178 #ifndef IPOPT_SID
  179 # define        IPOPT_SID       IPOPT_SATID
  180 #endif
  181 /*#define       IPOPT_SSRR      137 */
  182 #define IPOPT_ADDEXT    147     /* ADDEXT */
  183 #define IPOPT_VISA      142     /* VISA */
  184 #define IPOPT_IMITD     144     /* IMITD */
  185 #define IPOPT_EIP       145     /* EIP */
  186 #define IPOPT_FINN      205     /* FINN */
  187 
  188 
  189 #if defined(__FreeBSD__) && defined(KERNEL)
  190 # if __FreeBSD__ < 3
  191 #  include <machine/spl.h>
  192 # endif
  193 # if defined(IPFILTER_LKM) && !defined(ACTUALLY_LKM_NOT_KERNEL)
  194 #  define       ACTUALLY_LKM_NOT_KERNEL
  195 # endif
  196 #endif /* __FreeBSD__ && KERNEL */
  197 
  198 /*
  199  * Build some macros and #defines to enable the same code to compile anywhere
  200  * Well, that's the idea, anyway :-)
  201  */
  202 #ifdef KERNEL
  203 # if SOLARIS
  204 #  define       MUTEX_ENTER(x)  mutex_enter(x)
  205 #  define       MUTEX_EXIT(x)   mutex_exit(x)
  206 #  define       MTOD(m,t)       (t)((m)->b_rptr)
  207 #  define       IRCOPY(a,b,c)   copyin((a), (b), (c))
  208 #  define       IWCOPY(a,b,c)   copyout((a), (b), (c))
  209 #  define       FREE_MB_T(m)    freemsg(m)
  210 #  define       SPL_NET(x)      ;
  211 #  define       SPL_IMP(x)      ;
  212 #  undef        SPL_X
  213 #  define       SPL_X(x)        ;
  214 #  ifdef sparc
  215 #   define      ntohs(x)        (x)
  216 #   define      ntohl(x)        (x)
  217 #   define      htons(x)        (x)
  218 #   define      htonl(x)        (x)
  219 #  endif /* sparc */
  220 #  define       KMALLOC(a,b,c)  (a) = (b)kmem_alloc((c), KM_NOSLEEP)
  221 #  define       GET_MINOR(x)    getminor(x)
  222 typedef struct  qif     {
  223         struct  qif     *qf_next;
  224         ill_t   *qf_ill;
  225         kmutex_t        qf_lock;
  226         void    *qf_iptr;
  227         void    *qf_optr;
  228         queue_t *qf_in;
  229         queue_t *qf_out;
  230         struct  qinit   *qf_wqinfo;
  231         struct  qinit   *qf_rqinfo;
  232         struct  qinit   qf_wqinit;
  233         struct  qinit   qf_rqinit;
  234         mblk_t  *qf_m;  /* These three fields are for passing data up from */
  235         queue_t *qf_q;  /* fr_qin and fr_qout to the packet processing. */
  236         int     qf_off;
  237         int     qf_len; /* this field is used for in ipfr_fastroute */
  238         char    qf_name[8];
  239         /*
  240          * in case the ILL has disappeared...
  241          */
  242         int     qf_hl;  /* header length */
  243 } qif_t;
  244 extern  ill_t   *get_unit __P((char *));
  245 #  define       GETUNIT(n)      get_unit((n))
  246 # else /* SOLARIS */
  247 #  if defined(__sgi)
  248 #   include <sys/ksynch.h>
  249 #   define      IPF_LOCK_PL     plhi
  250 #   include <sys/sema.h>
  251 #undef kmutex_t
  252 typedef struct {
  253         lock_t *l;
  254         int pl;
  255 } kmutex_t;
  256 #   define      MUTEX_ENTER(x)  (x)->pl = LOCK((x)->l, IPF_LOCK_PL);
  257 #   define      MUTEX_EXIT(x)   UNLOCK((x)->l, (x)->pl);
  258 #  else /* __sgi */
  259 #   define      MUTEX_ENTER(x)  ;
  260 #   define      MUTEX_EXIT(x)   ;
  261 #  endif /* __sgi */
  262 #  ifndef linux
  263 #   define      FREE_MB_T(m)    m_freem(m)
  264 #   define      MTOD(m,t)       mtod(m,t)
  265 #   define      IRCOPY(a,b,c)   bcopy((a), (b), (c))
  266 #   define      IWCOPY(a,b,c)   bcopy((a), (b), (c))
  267 #  endif /* !linux */
  268 # endif /* SOLARIS */
  269 
  270 # ifdef sun
  271 #  if !SOLARIS
  272 #   include     <sys/kmem_alloc.h>
  273 #   define      GETUNIT(n)      ifunit((n), IFNAMSIZ)
  274 #  endif
  275 # else
  276 #  ifndef       linux
  277 #   define      GETUNIT(n)      ifunit((n))
  278 #  endif
  279 # endif /* sun */
  280 
  281 # if defined(sun) && !defined(linux) || defined(__sgi)
  282 #  define       UIOMOVE(a,b,c,d)        uiomove((caddr_t)a,b,c,d)
  283 #  define       SLEEP(id, n)    sleep((id), PZERO+1)
  284 #  define       WAKEUP(id)      wakeup(id)
  285 #  define       KFREE(x)        kmem_free((char *)(x), sizeof(*(x)))
  286 #  define       KFREES(x,s)     kmem_free((char *)(x), (s))
  287 #  if !SOLARIS
  288 extern  void    m_copydata __P((struct mbuf *, int, int, caddr_t));
  289 extern  void    m_copyback __P((struct mbuf *, int, int, caddr_t));
  290 #  endif
  291 #  ifdef __sgi
  292 #   include <sys/kmem.h>
  293 #   include <sys/ddi.h>
  294 #   define      KMALLOC(a,b,c)  (a) = (b)kmem_alloc((c), KM_NOSLEEP)
  295 #   define      GET_MINOR(x)    getminor(x)
  296 #  else
  297 #   if !SOLARIS
  298 #    define     KMALLOC(a,b,c)  (a) = (b)new_kmem_alloc((c), KMEM_NOSLEEP)
  299 #   endif /* SOLARIS */
  300 #  endif /* __sgi */
  301 # endif /* sun && !linux */
  302 # ifndef        GET_MINOR
  303 #  define       GET_MINOR(x)    minor(x)
  304 # endif
  305 # if (BSD >= 199306) || defined(__FreeBSD__)
  306 #  include <vm/vm.h>
  307 #  if !defined(__FreeBSD__) || (defined (__FreeBSD__) && __FreeBSD__>=3)
  308 #   include <vm/vm_extern.h>
  309 #   include <sys/proc.h>
  310 extern  vm_map_t        kmem_map;
  311 #  else /* !__FreeBSD__ || (__FreeBSD__ && __FreeBSD__>=3) */
  312 #   include <vm/vm_kern.h>
  313 #  endif /* !__FreeBSD__ || (__FreeBSD__ && __FreeBSD__>=3) */
  314 #  ifdef        M_PFIL
  315 #   define      KMALLOC(a, b, c)        MALLOC((a), b, (c), M_PFIL, M_NOWAIT)
  316 #   define      KFREE(x)        FREE((x), M_PFIL)
  317 #   define      KFREES(x,s)     FREE((x), M_PFIL)
  318 #  else
  319 #   define      KMALLOC(a, b, c)        MALLOC((a), b, (c), M_TEMP, M_NOWAIT)
  320 #   define      KFREE(x)        FREE((x), M_TEMP)
  321 #   define      KFREES(x,s)     FREE((x), M_TEMP)
  322 #  endif /* M_PFIL */
  323 #  define       UIOMOVE(a,b,c,d)        uiomove(a,b,d)
  324 #  define       SLEEP(id, n)    tsleep((id), PPAUSE|PCATCH, n, 0)
  325 #  define       WAKEUP(id)      wakeup(id)
  326 # endif /* BSD */
  327 # if defined(NetBSD) && NetBSD <= 1991011 && NetBSD >= 199407
  328 #  define       SPL_NET(x)      x = splsoftnet()
  329 #  define       SPL_X(x)        (void) splx(x)
  330 # else
  331 #  if !SOLARIS && !defined(linux)
  332 #   define      SPL_IMP(x)      x = splimp()
  333 #   define      SPL_NET(x)      x = splnet()
  334 #   define      SPL_X(x)        (void) splx(x)
  335 #  endif
  336 # endif /* NetBSD && NetBSD <= 1991011 && NetBSD >= 199407 */
  337 # define        PANIC(x,y)      if (x) panic y
  338 #else /* KERNEL */
  339 # define        SLEEP(x,y)      ;
  340 # define        WAKEUP(x)       ;
  341 # define        PANIC(x,y)      ;
  342 # define        MUTEX_ENTER(x)  ;
  343 # define        MUTEX_EXIT(x)   ;
  344 # define        SPL_NET(x)      ;
  345 # define        SPL_IMP(x)      ;
  346 # undef         SPL_X
  347 # define        SPL_X(x)        ;
  348 # define        KMALLOC(a,b,c)  (a) = (b)malloc(c)
  349 # define        KFREE(x)        free(x)
  350 # define        KFREES(x,s)     free(x)
  351 # define        GETUNIT(x)      get_unit(x)
  352 # define        IRCOPY(a,b,c)   bcopy((a), (b), (c))
  353 # define        IWCOPY(a,b,c)   bcopy((a), (b), (c))
  354 #endif /* KERNEL */
  355 
  356 #if SOLARIS
  357 typedef mblk_t mb_t;
  358 #else
  359 # ifdef linux
  360 typedef struct sk_buff mb_t;
  361 # else
  362 typedef struct mbuf mb_t;
  363 # endif
  364 #endif /* SOLARIS */
  365 
  366 #if defined(linux) || defined(__sgi)
  367 /*
  368  * These #ifdef's are here mainly for linux, but who knows, they may
  369  * not be in other places or maybe one day linux will grow up and some
  370  * of these will turn up there too.
  371  */
  372 #ifndef ICMP_MINLEN
  373 # define        ICMP_MINLEN     8
  374 #endif
  375 #ifndef ICMP_UNREACH
  376 # define        ICMP_UNREACH    ICMP_DEST_UNREACH
  377 #endif
  378 #ifndef ICMP_SOURCEQUENCH
  379 # define        ICMP_SOURCEQUENCH       ICMP_SOURCE_QUENCH
  380 #endif
  381 #ifndef ICMP_TIMXCEED
  382 # define        ICMP_TIMXCEED   ICMP_TIME_EXCEEDED
  383 #endif
  384 #ifndef ICMP_PARAMPROB
  385 # define        ICMP_PARAMPROB  ICMP_PARAMETERPROB
  386 #endif
  387 #ifndef ICMP_TSTAMP
  388 # define        ICMP_TSTAMP     ICMP_TIMESTAMP
  389 #endif
  390 #ifndef ICMP_TSTAMPREPLY
  391 # define        ICMP_TSTAMPREPLY        ICMP_TIMESTAMPREPLY
  392 #endif
  393 #ifndef ICMP_IREQ
  394 # define        ICMP_IREQ       ICMP_INFO_REQUEST
  395 #endif
  396 #ifndef ICMP_IREQREPLY
  397 # define        ICMP_IREQREPLY  ICMP_INFO_REPLY
  398 #endif
  399 #ifndef ICMP_MASKREQ
  400 # define        ICMP_MASKREQ    ICMP_ADDRESS
  401 #endif
  402 #ifndef ICMP_MASKREPLY
  403 # define        ICMP_MASKREPLY  ICMP_ADDRESSREPLY
  404 #endif
  405 #ifndef IPVERSION
  406 # define        IPVERSION       4
  407 #endif
  408 #ifndef IPOPT_MINOFF
  409 # define        IPOPT_MINOFF    4
  410 #endif
  411 #ifndef IPOPT_COPIED
  412 # define        IPOPT_COPIED(x) ((x)&0x80)
  413 #endif
  414 #ifndef IPOPT_EOL
  415 # define        IPOPT_EOL       0
  416 #endif
  417 #ifndef IPOPT_NOP
  418 # define        IPOPT_NOP       1
  419 #endif
  420 #ifndef IP_MF
  421 # define        IP_MF   ((u_short)0x2000)
  422 #endif
  423 #ifndef ETHERTYPE_IP
  424 # define        ETHERTYPE_IP    ((u_short)0x0800)
  425 #endif
  426 #ifndef TH_FIN
  427 # define        TH_FIN  0x01
  428 #endif
  429 #ifndef TH_SYN
  430 # define        TH_SYN  0x02
  431 #endif
  432 #ifndef TH_RST
  433 # define        TH_RST  0x04
  434 #endif
  435 #ifndef TH_PUSH
  436 # define        TH_PUSH 0x08
  437 #endif
  438 #ifndef TH_ACK
  439 # define        TH_ACK  0x10
  440 #endif
  441 #ifndef TH_URG
  442 # define        TH_URG  0x20
  443 #endif
  444 #ifndef IPOPT_EOL
  445 # define        IPOPT_EOL       0
  446 #endif
  447 #ifndef IPOPT_NOP
  448 # define        IPOPT_NOP       1
  449 #endif
  450 #ifndef IPOPT_RR
  451 # define        IPOPT_RR        7
  452 #endif
  453 #ifndef IPOPT_TS
  454 # define        IPOPT_TS        68
  455 #endif
  456 #ifndef IPOPT_SECURITY
  457 # define        IPOPT_SECURITY  130
  458 #endif
  459 #ifndef IPOPT_LSRR
  460 # define        IPOPT_LSRR      131
  461 #endif
  462 #ifndef IPOPT_SATID
  463 # define        IPOPT_SATID     136
  464 #endif
  465 #ifndef IPOPT_SSRR
  466 # define        IPOPT_SSRR      137
  467 #endif
  468 #ifndef IPOPT_SECUR_UNCLASS
  469 # define        IPOPT_SECUR_UNCLASS     ((u_short)0x0000)
  470 #endif
  471 #ifndef IPOPT_SECUR_CONFID
  472 # define        IPOPT_SECUR_CONFID      ((u_short)0xf135)
  473 #endif
  474 #ifndef IPOPT_SECUR_EFTO
  475 # define        IPOPT_SECUR_EFTO        ((u_short)0x789a)
  476 #endif
  477 #ifndef IPOPT_SECUR_MMMM
  478 # define        IPOPT_SECUR_MMMM        ((u_short)0xbc4d)
  479 #endif
  480 #ifndef IPOPT_SECUR_RESTR
  481 # define        IPOPT_SECUR_RESTR       ((u_short)0xaf13)
  482 #endif
  483 #ifndef IPOPT_SECUR_SECRET
  484 # define        IPOPT_SECUR_SECRET      ((u_short)0xd788)
  485 #endif
  486 #ifndef IPOPT_SECUR_TOPSECRET
  487 # define        IPOPT_SECUR_TOPSECRET   ((u_short)0x6bc5)
  488 #endif
  489 #ifndef IPOPT_OLEN
  490 # define        IPOPT_OLEN      1
  491 #endif
  492 #endif /* linux || __sgi */
  493 
  494 #ifdef  linux
  495 /*
  496  * TCP States
  497  */
  498 #define TCPS_CLOSED             0       /* closed */
  499 #define TCPS_LISTEN             1       /* listening for connection */
  500 #define TCPS_SYN_SENT           2       /* active, have sent syn */
  501 #define TCPS_SYN_RECEIVED       3       /* have send and received syn */
  502 /* states < TCPS_ESTABLISHED are those where connections not established */
  503 #define TCPS_ESTABLISHED        4       /* established */
  504 #define TCPS_CLOSE_WAIT         5       /* rcvd fin, waiting for close */
  505 /* states > TCPS_CLOSE_WAIT are those where user has closed */
  506 #define TCPS_FIN_WAIT_1         6       /* have closed, sent fin */
  507 #define TCPS_CLOSING            7       /* closed xchd FIN; await FIN ACK */
  508 #define TCPS_LAST_ACK           8       /* had fin and close; await FIN ACK */
  509 /* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */
  510 #define TCPS_FIN_WAIT_2         9       /* have closed, fin is acked */
  511 #define TCPS_TIME_WAIT          10      /* in 2*msl quiet wait after close */
  512 
  513 /*
  514  * file flags.
  515  */
  516 #define FWRITE  WRITE
  517 #define FREAD   READ
  518 /*
  519  * mbuf related problems.
  520  */
  521 #define mtod(m,t)       (t)((m)->data)
  522 #define m_len           len
  523 #define m_next          next
  524 
  525 #define IP_DF           0x8000
  526 
  527 typedef struct  {
  528         __u16   th_sport;
  529         __u16   th_dport;
  530         __u32   th_seq;
  531         __u32   th_ack;
  532 # if defined(__i386__) || defined(__MIPSEL__) || defined(__alpha__) ||\
  533     defined(vax)
  534         __u8    th_res:4;
  535         __u8    th_off:4;
  536 #else
  537         __u8    th_off:4;
  538         __u8    th_res:4;
  539 #endif
  540         __u8    th_flags;
  541         __u16   th_win;
  542         __u16   th_sum;
  543         __u16   th_urp;
  544 } tcphdr_t;
  545 
  546 typedef struct  {
  547         __u16   uh_sport;
  548         __u16   uh_dport;
  549         __u16   uh_ulen;
  550         __u16   uh_sum;
  551 } udphdr_t;
  552 
  553 typedef struct  {
  554 # if defined(__i386__) || defined(__MIPSEL__) || defined(__alpha__) ||\
  555     defined(vax)
  556         __u8    ip_hl:4;
  557         __u8    ip_v:4;
  558 # else
  559         __u8    ip_hl:4;
  560         __u8    ip_v:4;
  561 # endif
  562         __u8    ip_tos;
  563         __u16   ip_len;
  564         __u16   ip_id;
  565         __u16   ip_off;
  566         __u8    ip_ttl;
  567         __u8    ip_p;
  568         __u16   ip_sum;
  569         struct  in_addr ip_src;
  570         struct  in_addr ip_dst;
  571 } ip_t;
  572 
  573 /*
  574  * Structure of an icmp header.
  575  */
  576 typedef struct icmp {
  577         u_char  icmp_type;              /* type of message, see below */
  578         u_char  icmp_code;              /* type sub code */
  579         u_short icmp_cksum;             /* ones complement cksum of struct */
  580         union {
  581                 u_char ih_pptr;                 /* ICMP_PARAMPROB */
  582                 struct in_addr ih_gwaddr;       /* ICMP_REDIRECT */
  583                 struct ih_idseq {
  584                         n_short icd_id;
  585                         n_short icd_seq;
  586                 } ih_idseq;
  587                 int ih_void;
  588         } icmp_hun;
  589 # define        icmp_pptr       icmp_hun.ih_pptr
  590 # define        icmp_gwaddr     icmp_hun.ih_gwaddr
  591 # define        icmp_id         icmp_hun.ih_idseq.icd_id
  592 # define        icmp_seq        icmp_hun.ih_idseq.icd_seq
  593 # define        icmp_void       icmp_hun.ih_void
  594         union {
  595                 struct id_ts {
  596                         n_time its_otime;
  597                         n_time its_rtime;
  598                         n_time its_ttime;
  599                 } id_ts;
  600                 struct id_ip  {
  601                         ip_t idi_ip;
  602                         /* options and then 64 bits of data */
  603                 } id_ip;
  604                 u_long  id_mask;
  605                 char    id_data[1];
  606         } icmp_dun;
  607 # define        icmp_otime      icmp_dun.id_ts.its_otime
  608 # define        icmp_rtime      icmp_dun.id_ts.its_rtime
  609 # define        icmp_ttime      icmp_dun.id_ts.its_ttime
  610 # define        icmp_ip         icmp_dun.id_ip.idi_ip
  611 # define        icmp_mask       icmp_dun.id_mask
  612 # define        icmp_data       icmp_dun.id_data
  613 } icmphdr_t;
  614 
  615 # ifndef LINUX_IPOVLY
  616 #  define LINUX_IPOVLY
  617 struct ipovly {
  618         caddr_t ih_next, ih_prev;       /* for protocol sequence q's */
  619         u_char  ih_x1;                  /* (unused) */
  620         u_char  ih_pr;                  /* protocol */
  621         short   ih_len;                 /* protocol length */
  622         struct  in_addr ih_src;         /* source internet address */
  623         struct  in_addr ih_dst;         /* destination internet address */
  624 };
  625 # endif
  626 
  627 typedef struct  {
  628         __u8    ether_dhost[6];
  629         __u8    ether_shost[6];
  630         __u16   ether_type;
  631 } ether_header_t;
  632 
  633 typedef struct  uio     {
  634         int     uio_resid;
  635         int     uio_rw;
  636         caddr_t uio_buf;
  637 } uio_t;
  638 
  639 # define        UIO_READ        0
  640 # define        UIO_WRITE       1
  641 # define        UIOMOVE(a, b, c, d)     uiomove(a,b,c,d)
  642 
  643 /*
  644  * For masking struct ifnet onto struct device
  645  */
  646 # define        if_name name
  647 
  648 # ifdef KERNEL
  649 #  define       GETUNIT(x)      dev_get(x)
  650 #  define       FREE_MB_T(m)    kfree_skb(m, FREE_WRITE)
  651 #  define       uniqtime        do_gettimeofday
  652 #  undef INT_MAX
  653 #  undef UINT_MAX
  654 #  undef LONG_MAX
  655 #  undef ULONG_MAX
  656 #  include <linux/netdevice.h>
  657 #  define       SPL_X(x)
  658 #  define       SPL_NET(x)
  659 #  define       SPL_IMP(x)
  660  
  661 #  define       bcmp(a,b,c)     memcmp(a,b,c)
  662 #  define       bcopy(a,b,c)    memcpy(b,a,c)
  663 #  define       bzero(a,c)      memset(a,0,c)
  664 
  665 #  define       UNITNAME(n)     dev_get((n))
  666 
  667 #  define       KMALLOC(a,b,c)  (a) = (b)kmalloc((c), GFP_ATOMIC)
  668 #  define       KFREE(x)        kfree_s((x), sizeof(*(x)))
  669 #  define       KFREES(x,s)     kfree_s((x), (s))
  670 #  define       IRCOPY(a,b,c)   { \
  671                                  error = verify_area(VERIFY_READ, (a) ,(c)); \
  672                                  if (!error) \
  673                                         memcpy_fromfs((b), (a), (c)); \
  674                                 }
  675 #  define       IWCOPY(a,b,c)   { \
  676                                  error = verify_area(VERIFY_WRITE, (b), (c)); \
  677                                  if (!error) \
  678                                         memcpy_tofs((b), (a), (c)); \
  679                                 }
  680 # else
  681 #  define       __KERNEL__
  682 #  undef INT_MAX
  683 #  undef UINT_MAX
  684 #  undef LONG_MAX
  685 #  undef ULONG_MAX
  686 #  define       s8 __s8
  687 #  define       u8 __u8
  688 #  define       s16 __s16
  689 #  define       u16 __u16
  690 #  define       s32 __s32
  691 #  define       u32 __u32
  692 #  include <linux/netdevice.h>
  693 #  undef        __KERNEL__
  694 # endif
  695 # define        ifnet   device
  696 #else
  697 typedef struct  tcphdr  tcphdr_t;
  698 typedef struct  udphdr  udphdr_t;
  699 typedef struct  icmp    icmphdr_t;
  700 typedef struct  ip      ip_t;
  701 typedef struct  ether_header    ether_header_t;
  702 #endif /* linux */
  703 typedef struct  tcpiphdr        tcpiphdr_t;
  704 
  705 #if defined(hpux) || defined(linux)
  706 struct  ether_addr      {
  707         char    ether_addr_octet[6];
  708 };
  709 #endif
  710 
  711 /*
  712  * XXX - This is one of those *awful* hacks which nobody likes
  713  */
  714 #ifdef  ultrix
  715 #define A_A
  716 #else
  717 #define A_A     &
  718 #endif
  719 
  720 #ifndef ICMP_ROUTERADVERT
  721 # define        ICMP_ROUTERADVERT       9
  722 #endif
  723 #ifndef ICMP_ROUTERSOLICIT
  724 # define        ICMP_ROUTERSOLICIT      10
  725 #endif
  726 
  727 #endif  /* __IP_COMPAT_H__ */

Cache object: 7d9f06f2fbcc1a278baf3cbc63901dcd


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.