root/netatalk/ddp.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


    1 /*      $OpenBSD: ddp.h,v 1.2 2005/12/11 17:21:53 deraadt Exp $ */
    2 
    3 /*
    4  * Copyright (c) 1990,1991 Regents of The University of Michigan.
    5  * All Rights Reserved.
    6  *
    7  * Permission to use, copy, modify, and distribute this software and
    8  * its documentation for any purpose and without fee is hereby granted,
    9  * provided that the above copyright notice appears in all copies and
   10  * that both that copyright notice and this permission notice appear
   11  * in supporting documentation, and that the name of The University
   12  * of Michigan not be used in advertising or publicity pertaining to
   13  * distribution of the software without specific, written prior
   14  * permission. This software is supplied as is without expressed or
   15  * implied warranties of any kind.
   16  *
   17  *      Research Systems Unix Group
   18  *      The University of Michigan
   19  *      c/o Mike Clark
   20  *      535 W. William Street
   21  *      Ann Arbor, Michigan
   22  *      +1-313-763-0525
   23  *      netatalk@itd.umich.edu
   24  */
   25 
   26 /*
   27  * The following is the contents of the COPYRIGHT file from the
   28  * netatalk-1.4a2 distribution, from which this file is derived.
   29  */
   30 /*
   31  * Copyright (c) 1990,1996 Regents of The University of Michigan.
   32  *
   33  * All Rights Reserved.
   34  *
   35  *    Permission to use, copy, modify, and distribute this software and
   36  *    its documentation for any purpose and without fee is hereby granted,
   37  *    provided that the above copyright notice appears in all copies and
   38  *    that both that copyright notice and this permission notice appear
   39  *    in supporting documentation, and that the name of The University
   40  *    of Michigan not be used in advertising or publicity pertaining to
   41  *    distribution of the software without specific, written prior
   42  *    permission. This software is supplied as is without expressed or
   43  *    implied warranties of any kind.
   44  *
   45  * This product includes software developed by the University of
   46  * California, Berkeley and its contributors.
   47  *
   48  * Solaris code is encumbered by the following:
   49  *
   50  *     Copyright (C) 1996 by Sun Microsystems Computer Co.
   51  *
   52  *     Permission to use, copy, modify, and distribute this software and
   53  *     its documentation for any purpose and without fee is hereby
   54  *     granted, provided that the above copyright notice appear in all
   55  *     copies and that both that copyright notice and this permission
   56  *     notice appear in supporting documentation.  This software is
   57  *     provided "as is" without express or implied warranty.
   58  *
   59  * Research Systems Unix Group
   60  * The University of Michigan
   61  * c/o Wesley Craig
   62  * 535 W. William Street
   63  * Ann Arbor, Michigan
   64  * +1-313-764-2278
   65  * netatalk@umich.edu
   66  */
   67 /*
   68  * None of the Solaris code mentioned is included in OpenBSD.
   69  * This code also relies heavily on previous effort in FreeBSD and NetBSD.
   70  */
   71 
   72 #ifndef _NETATALK_DDP_H_
   73 #define _NETATALK_DDP_H_ 1
   74 
   75 /*
   76  * <-1byte(8bits) ->
   77  * +---------------+
   78  * | 0 | hopc  |len|
   79  * +---------------+
   80  * | len (cont)    |
   81  * +---------------+
   82  * |               |
   83  * +- DDP csum    -+
   84  * |               |
   85  * +---------------+
   86  * |               |
   87  * +- Dest NET    -+
   88  * |               |
   89  * +---------------+
   90  * |               |
   91  * +- Src NET     -+
   92  * |               |
   93  * +---------------+
   94  * | Dest NODE     |
   95  * +---------------+
   96  * | Src NODE      |
   97  * +---------------+
   98  * | Dest PORT     |
   99  * +---------------+
  100  * | Src PORT      |
  101  * +---------------+
  102  *
  103  * On Apples, there is also a ddp_type field, after src_port. However,
  104  * under this unix implementation, user level processes need to be able
  105  * to set the ddp_type. In later revisions, the ddp_type may only be
  106  * available in a raw_appletalk interface.
  107  */
  108 
  109 struct elaphdr {
  110     u_char      el_dnode;
  111     u_char      el_snode;
  112     u_char      el_type;
  113 };
  114 
  115 #define SZ_ELAPHDR      3
  116 
  117 #define ELAP_DDPSHORT   0x01
  118 #define ELAP_DDPEXTEND  0x02
  119 
  120 /*
  121  * Extended DDP header. Includes sickness for dealing with arbitrary
  122  * bitfields on a little-endian arch.
  123  */
  124 struct ddpehdr {
  125     union {
  126         struct {
  127 #if BYTE_ORDER == BIG_ENDIAN
  128     unsigned int        dub_pad:2;
  129     unsigned int        dub_hops:4;
  130     unsigned int        dub_len:10;
  131     unsigned int        dub_sum:16;
  132 #endif
  133 #if BYTE_ORDER == LITTLE_ENDIAN
  134     unsigned int        dub_sum:16;
  135     unsigned int        dub_len:10;
  136     unsigned int        dub_hops:4;
  137     unsigned int        dub_pad:2;
  138 #endif
  139         } du_bits;
  140         unsigned int    du_bytes;
  141     } deh_u;
  142 #define deh_pad         deh_u.du_bits.dub_pad
  143 #define deh_hops        deh_u.du_bits.dub_hops
  144 #define deh_len         deh_u.du_bits.dub_len
  145 #define deh_sum         deh_u.du_bits.dub_sum
  146 #define deh_bytes       deh_u.du_bytes
  147     u_short             deh_dnet;
  148     u_short             deh_snet;
  149     u_char              deh_dnode;
  150     u_char              deh_snode;
  151     u_char              deh_dport;
  152     u_char              deh_sport;
  153 };
  154 
  155 #define DDP_MAXHOPS     15
  156 
  157 struct ddpshdr {
  158     union {
  159         struct {
  160 #if BYTE_ORDER == BIG_ENDIAN
  161     unsigned int        dub_pad:6;
  162     unsigned int        dub_len:10;
  163     unsigned int        dub_dport:8;
  164     unsigned int        dub_sport:8;
  165 #endif
  166 #if BYTE_ORDER == LITTLE_ENDIAN
  167     unsigned int        dub_sport:8;
  168     unsigned int        dub_dport:8;
  169     unsigned int        dub_len:10;
  170     unsigned int        dub_pad:6;
  171 #endif
  172         } du_bits;
  173         unsigned int    du_bytes;
  174     } dsh_u;
  175 #define dsh_pad         dsh_u.du_bits.dub_pad
  176 #define dsh_len         dsh_u.du_bits.dub_len
  177 #define dsh_dport       dsh_u.du_bits.dub_dport
  178 #define dsh_sport       dsh_u.du_bits.dub_sport
  179 #define dsh_bytes       dsh_u.du_bytes
  180 };
  181 #endif /* _NETATALK_DDP_H_ */

/* [<][>][^][v][top][bottom][index][help] */