Annotation of kernel/bsd/netat/h/localglue.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
        !             7:  * Reserved.  This file contains Original Code and/or Modifications of
        !             8:  * Original Code as defined in and that are subject to the Apple Public
        !             9:  * Source License Version 1.1 (the "License").  You may not use this file
        !            10:  * except in compliance with the License.  Please obtain a copy of the
        !            11:  * License at http://www.apple.com/publicsource and read it before using
        !            12:  * this file.
        !            13:  * 
        !            14:  * The Original Code and all software distributed under the License are
        !            15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
        !            19:  * License for the specific language governing rights and limitations
        !            20:  * under the License.
        !            21:  * 
        !            22:  * @APPLE_LICENSE_HEADER_END@
        !            23:  */
        !            24: 
        !            25: /*
        !            26:  * localglue.h:
        !            27:  * Assorted local glue.
        !            28:  */
        !            29: 
        !            30: #ifndef LOCALGLUE_H
        !            31: #define        LOCALGLUE_H
        !            32: 
        !            33: #include <sys/errno.h>
        !            34: #include <sys/types.h>
        !            35: #include <sys/param.h>
        !            36: #include <machine/spl.h>
        !            37: 
        !            38: 
        !            39: #define AT_ATP_LINK    111
        !            40: #define AT_ATP_UNLINK  222
        !            41: #define AT_ADSP_LINK   333
        !            42: #define AT_ADSP_UNLINK 444
        !            43: 
        !            44: typedef struct {
        !            45:        int  maxlen; /* max buffer length */
        !            46:        int  len;    /* length of data */
        !            47:        char *buf;   /* pointer to buffer */
        !            48: } strbuf_t;
        !            49: typedef struct {
        !            50:        int  ic_cmd;
        !            51:        int  ic_timout;
        !            52:        int  ic_len;
        !            53:        char *ic_dp;
        !            54: } ioccmd_t;
        !            55: typedef struct {
        !            56:        int  ioc_cmd;
        !            57:        void *ioc_cr;
        !            58:        int  ioc_id;
        !            59:        int  ioc_cnt;
        !            60:        int  ioc_error;
        !            61:        int  ioc_rval;
        !            62:        void    *ioc_private;
        !            63:        int  ioc_filler[4];
        !            64: } ioc_t;
        !            65: #ifndef ioc_count
        !            66: #define ioc_count ioc_cnt
        !            67: #endif
        !            68: #ifndef MOREDATA
        !            69: #define MOREDATA 1
        !            70: #endif
        !            71: 
        !            72: #ifdef NEXT
        !            73: /* 
        !            74:  * Rhapsody specific defines: Right now they're triggered
        !            75:  * by the NEXT define. Might want to change that latter
        !            76:  * ld 04/28/97
        !            77:  */
        !            78: 
        !            79: #define RHAPSODY 1
        !            80: /* HZ ticks definition used throughout AppleTalk */
        !            81: #define HZ hz
        !            82: 
        !            83: /* returned when the operation is not possible at this
        !            84:  * time (ie when starting up or shutting down.
        !            85:  * right now, uses ESHUTDOWN because ENOTREADY is not defined
        !            86:  * in Rhapsody. Need to find a better Error code ###LD
        !            87:  */
        !            88: #define ENOTREADY      ESHUTDOWN
        !            89: #define ENOMSG                 EOPNOTSUPP
        !            90: #define EPROTO                 EPROTOTYPE
        !            91: #define ENOSR          ENOBUFS
        !            92: #define ECHRNG         EOPNOTSUPP
        !            93: 
        !            94: 
        !            95: /* T_MPSAFE is used only in atp_open. I suspect it's a
        !            96:  * trick to accelerate local atp transactions.
        !            97:  */
        !            98: #define T_MPSAFE       0
        !            99: 
        !           100: #define INTERRUPTIBLE   1
        !           101: #define POLLIN                 0x0001
        !           102: #define POLLOUT        0x0002
        !           103: #define POLLPRI        0x0004
        !           104: #define POLLMSG        0x0080
        !           105: #define POLLSYNC       0x8000
        !           106: #define POLLMSG        0x0080
        !           107: 
        !           108: /*
        !           109:  * Define a new Data Type for file. it was DTYPE_OTHER for 
        !           110:  * AIX, for Rhapsody there is no such define so defines
        !           111:  * DTYPE_ATALK
        !           112:  */
        !           113: 
        !           114: #define DTYPE_ATALK -1
        !           115: 
        !           116: typedef unsigned char uchar;
        !           117: 
        !           118: #endif
        !           119: 
        !           120: 
        !           121: #ifdef _KERNEL
        !           122: #include <sys/systm.h>
        !           123: /* ### LD 4/28/97 tempo removed */
        !           124: #ifdef _AIX
        !           125: #include <sys/pri.h>
        !           126: #include <sys/intr.h>
        !           127: #include <sys/lockl.h>
        !           128: #include <net/spl.h>
        !           129: #else
        !           130: #include <sys/kernel.h>
        !           131: #include <sys/proc.h>
        !           132: #include <sys/filedesc.h>
        !           133: #include <sys/fcntl.h>
        !           134: #endif
        !           135: #include <sys/mbuf.h>
        !           136: 
        !           137: #define AT_WR_OFFSET 38
        !           138: #ifndef EVENT_NULL
        !           139: #define EVENT_NULL   -1
        !           140: #define LOCK_HANDLER  2
        !           141: #endif
        !           142: typedef int atevent_t;
        !           143: /* ### LD 4/28/97 tempo removed */
        !           144: #ifdef _AIX
        !           145: typedef Simple_lock atlock_t;
        !           146: #define ATLOCKINIT(a)   simple_lock_init((void *)&a)
        !           147: #define ATDISABLE(l, a) (l = disable_lock(PL_IMP, (void *)&a))
        !           148: #define ATENABLE(l, a)  unlock_enable(l, (void *)&a)
        !           149: #define ATEVENTINIT(a)  (a = EVENT_NULL)
        !           150: #define DDP_OUTPUT(m) ddp_putmsg(0,m)
        !           151: #define StaticProc static
        !           152: 
        !           153: #define PRI_LO         1
        !           154: #define PRI_MED        2
        !           155: #define PRI_HI         3
        !           156: 
        !           157: #else
        !           158: 
        !           159: /* ### LD 4/28/97 tempo for next */
        !           160: 
        !           161: typedef simple_lock_t atlock_t;
        !           162: typedef int *atomic_p; 
        !           163: #define ATLOCKINIT(a)  (a = EVENT_NULL)
        !           164: #define ATDISABLE(l, a) (l = splimp())
        !           165: #define ATENABLE(l, a)  splx(l)
        !           166: #define ATEVENTINIT(a)  (a = EVENT_NULL)
        !           167: #define DDP_OUTPUT(m) ddp_putmsg(0,m)
        !           168: #define StaticProc static
        !           169: 
        !           170: #define PRI_LO         1
        !           171: #define PRI_MED        2
        !           172: #define PRI_HI         3
        !           173: 
        !           174: 
        !           175: #endif
        !           176: 
        !           177: typedef struct mbuf gbuf_t;
        !           178: extern gbuf_t *gbuf_copym();
        !           179: extern gbuf_t *gbuf_dupb();
        !           180: extern gbuf_t *gbuf_dupm();
        !           181: extern void gbuf_freeb();
        !           182: extern void gbuf_freem();
        !           183: extern gbuf_t *gbuf_alloc();
        !           184: #define gbuf_prepend(m,len) M_PREPEND(m,len,M_DONTWAIT)
        !           185: #define gbuf_attach(buf,func,len,arg) m_clattach(buf,func,len,arg,M_DONTWAIT)
        !           186: #define gbuf_cont(m)   m->m_next
        !           187: #define gbuf_next(m)   m->m_nextpkt
        !           188: #define gbuf_rptr(m)   m->m_data
        !           189: #define gbuf_rinc(m,len)       {m->m_data += len; m->m_len -= len;}
        !           190: #define gbuf_rdec(m,len)       {m->m_data -= len; m->m_len += len;}
        !           191: #define gbuf_wptr(m)   (m->m_data + m->m_len)
        !           192: #define gbuf_winc(m,len)       (m->m_len += len)
        !           193: #define gbuf_wdec(m,len)       (m->m_len -= len)
        !           194: #define gbuf_wset(m,len)       (m->m_len = len)
        !           195: #define gbuf_type(m)   m->m_type
        !           196: #define gbuf_len(m)    m->m_len
        !           197: 
        !           198: typedef struct gref {
        !           199:        struct gref *next;
        !           200:        void *info;
        !           201:        gbuf_t *ichead;
        !           202:        gbuf_t *ictail;
        !           203:        gbuf_t *rdhead;
        !           204:        gbuf_t *rdtail;
        !           205:        unsigned char  proto;
        !           206:        unsigned char  errno;
        !           207:        unsigned short sevents;
        !           208:        int pid;
        !           209:        atlock_t lock;
        !           210:        atevent_t event;
        !           211:        atevent_t iocevent;
        !           212:        int (*writeable)();
        !           213:        int (*readable)();
        !           214:        /* for BSD 4.4 we need a selinfo structure for selrecord/selwakeup */
        !           215: #ifndef _AIX
        !           216:        struct selinfo si;
        !           217: #endif
        !           218: } gref_t;
        !           219: 
        !           220: #undef timeoutcf
        !           221: #undef timeout
        !           222: #undef untimeout
        !           223: #define        MAXATALKTIMERS          128
        !           224: 
        !           225: /* prototypes for the gbuf routines */
        !           226: 
        !           227: gbuf_t *gbuf_alloc(int size, int pri);
        !           228: void gbuf_freeb(gbuf_t *m);
        !           229: int gbuf_freel(gbuf_t *m);
        !           230: void gbuf_linkb(gbuf_t *m1, gbuf_t *m2);
        !           231: int gbuf_msgsize(gbuf_t *m);
        !           232: void gbuf_set_type(gbuf_t *m, short mtype);
        !           233: 
        !           234: void data_error(int errno, gbuf_t *mp, gref_t *gref);
        !           235: 
        !           236: #endif         /* _KERNEL */
        !           237: 
        !           238: /*
        !           239:  * Want these definitions outside the _KERNEL define for admin
        !           240:  * program access.
        !           241:  */
        !           242: #ifdef _AIX
        !           243: #define MSG_DATA       0x00
        !           244: #define MSG_PROTO      0x01
        !           245: #define MSG_IOCTL      0x0e
        !           246: #define MSG_ERROR      0x8a
        !           247: #define MSG_HANGUP     0x89
        !           248: #define MSG_IOCACK     0x81
        !           249: #define MSG_IOCNAK     0x82
        !           250: #define MSG_CTL                0x0d
        !           251: #else
        !           252: /* ### LD 5/3/97 Rhapsody porting note:
        !           253:  * Cannot use MSG_DATA = 0, because MT_FREE is defined as 0
        !           254:  * and the sanity check in m_free cause a panic.
        !           255:  */
        !           256:  
        !           257: #define MSG_DATA       (MT_MAX - 1)
        !           258: #define MSG_PROTO      (MT_MAX - 2)
        !           259: #define MSG_IOCTL      (MT_MAX - 3)
        !           260: #define MSG_ERROR      (MT_MAX - 4)
        !           261: #define MSG_HANGUP     (MT_MAX - 5)
        !           262: #define MSG_IOCACK     (MT_MAX - 6)
        !           263: #define MSG_IOCNAK     (MT_MAX - 7)
        !           264: #define MSG_CTL                (MT_MAX - 8)
        !           265: #endif
        !           266: 
        !           267: #endif /* LOCALGLUE_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.