Source to bsd/netat/h/localglue.h.pre0529


Enter a symbol's name here to quickly find it.

/*
 * localglue.h:
 * Assorted local glue.
 */

#ifndef LOCALGLUE_H
#define	LOCALGLUE_H

#include <sys/errno.h>
#include <sys/types.h>
#include <sys/param.h>


#define AT_ATP_LINK    111
#define AT_ATP_UNLINK  222
#define AT_ADSP_LINK   333
#define AT_ADSP_UNLINK 444

typedef struct {
	int  maxlen; /* max buffer length */
	int  len;    /* length of data */
	char *buf;   /* pointer to buffer */
} strbuf_t;
typedef struct {
	int  ic_cmd;
	int  ic_timout;
	int  ic_len;
	char *ic_dp;
} ioccmd_t;
typedef struct {
	int  ioc_cmd;
	void *ioc_cr;
	int  ioc_id;
	int  ioc_cnt;
	int  ioc_error;
	int  ioc_rval;
	void	*ioc_private;
	int  ioc_filler[4];
} ioc_t;
#ifndef ioc_count
#define ioc_count ioc_cnt
#endif
#ifndef MOREDATA
#define MOREDATA 1
#endif

#ifdef _KERNEL
#include <sys/systm.h>
/* ### LD 4/28/97 tempo removed */
#ifdef _AIX
#include <sys/pri.h>
#include <sys/intr.h>
#include <sys/lockl.h>
#include <net/spl.h>
#else
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/filedesc.h>
#include <sys/fcntl.h>
#endif
#include <sys/mbuf.h>

/*
 * Rhapsody: we can't include stdlib.h (which contains atoi) in the
 * kernel because it conflics with libkern.h for "random"
 * so we use the inline definition of atoi here...
 *
 */
#ifndef _AIX
#define atoi(x) (int)((x)-'0') 
#endif

#define AT_WR_OFFSET 38
#ifndef EVENT_NULL
#define EVENT_NULL   -1
#define LOCK_HANDLER  2
#endif
typedef int atevent_t;
/* ### LD 4/28/97 tempo removed */
#ifdef _AIX
typedef Simple_lock atlock_t;
#define ATLOCKINIT(a)   simple_lock_init((void *)&a)
#define ATDISABLE(l, a) (l = disable_lock(PL_IMP, (void *)&a))
#define ATENABLE(l, a)  unlock_enable(l, (void *)&a)
#define ATEVENTINIT(a)  (a = EVENT_NULL)
#define DDP_OUTPUT(m) ddp_putmsg(0,m)
#define StaticProc static
#else
/* ### LD 4/28/97 tempo for next */
typedef simple_lock_t atlock_t;
typedef int *atomic_p; 
#define ATLOCKINIT(a)  (a = EVENT_NULL)
#define ATDISABLE(l, a) (l = splnet())
#define ATENABLE(l, a)  splx(l)
#define ATEVENTINIT(a)  (a = EVENT_NULL)
#define DDP_OUTPUT(m) ddp_putmsg(0,m)
#define StaticProc static

#endif
#ifdef NEXT
/* 
 * Rhapsody specific defines: Right now they're triggered
 * by the NEXT define. Might want to change that latter
 * ld 04/28/97
 */

#define RHAPSODY 1
/* HZ ticks definition used throughout AppleTalk */
#define HZ hz

/* returned when the operation is not possible at this
 * time (ie when starting up or shutting down.
 * right now, uses ESHUTDOWN because ENOTREADY is not defined
 * in Rhapsody. Need to find a better Error code ###LD
 */
#define ENOTREADY 	ESHUTDOWN
#define ENOMSG 		EOPNOTSUPP
#define EPROTO 		EPROTOTYPE
#define ENOSR		ENOBUFS

/* T_MPSAFE is used only in atp_open. I suspect it's a
 * trick to accelerate local atp transactions.
 */
#define T_MPSAFE	0

#define INTERRUPTIBLE   1
#define POLLIN 		0x0001
#define POLLOUT 	0x0002
#define POLLPRI 	0x0004
#define POLLMSG 	0x0080
#define POLLSYNC 	0x8000
#define POLLMSG 	0x0080

/*
 * Define a new Data Type for file. it was DTYPE_OTHER for 
 * AIX, for Rhapsody there is no such define so defines
 * DTYPE_ATALK
 */

#define DTYPE_ATALK -1

typedef unsigned char uchar;

#endif

#define MSG_DATA	0x00
#define MSG_PROTO	0x01
#define MSG_IOCTL	0x0e
#define MSG_ERROR	0x8a
#define MSG_HANGUP	0x89
#define MSG_IOCACK	0x81
#define MSG_IOCNAK	0x82
#define MSG_CTL	0x0d
#define PRI_LO		1
#define PRI_MED	2
#define PRI_HI		3

typedef struct mbuf gbuf_t;
extern gbuf_t *gbuf_copym();
extern gbuf_t *gbuf_dupb();
extern gbuf_t *gbuf_dupm();
extern void gbuf_freeb();
extern void gbuf_freem();
extern gbuf_t *gbuf_alloc();
#define gbuf_prepend(m,len) M_PREPEND(m,len,M_DONTWAIT)
#define gbuf_attach(buf,func,len,arg) m_clattach(buf,func,len,arg,M_DONTWAIT)
#define gbuf_cont(m)	m->m_next
#define gbuf_next(m)	m->m_nextpkt
#define gbuf_rptr(m)	m->m_data
#define gbuf_rinc(m,len)	{m->m_data += len; m->m_len -= len;}
#define gbuf_rdec(m,len)	{m->m_data -= len; m->m_len += len;}
#define gbuf_wptr(m)	(m->m_data + m->m_len)
#define gbuf_winc(m,len)	(m->m_len += len)
#define gbuf_wdec(m,len)	(m->m_len -= len)
#define gbuf_wset(m,len)	(m->m_len = len)
#define gbuf_type(m)	m->m_type
#define gbuf_len(m)	m->m_len

typedef struct gref {
	struct gref *next;
	void *info;
	gbuf_t *ichead;
	gbuf_t *ictail;
	gbuf_t *rdhead;
	gbuf_t *rdtail;
	unsigned char  proto;
	unsigned char  errno;
	unsigned short sevents;
	int pid;
	atlock_t lock;
	atevent_t event;
	atevent_t iocevent;
	int (*writeable)();
	int (*readable)();
	/* for BSD 4.4 we need a selinfo structure for selrecord/selwakeup */
#ifndef _AIX
	struct selinfo si;
#endif
} gref_t;

#undef timeoutcf
#undef timeout
#undef untimeout
#define	MAXATALKTIMERS		128

#else 	/* _KERNEL */

/* Various device info */
#define AT_DEF_ET_INTERFACE	"et0"
#define NVRAM		"/etc/appletalk.nvram"
#define NVRAMSIZE	256

#endif		/* _KERNEL */

#endif /* LOCALGLUE_H */