📄 pna.h
字号:
long ifr_ifno; union { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; unsigned long ifru_flags; int ifru_mtu; char *ifru_data; } ifr_ifru;#define ifr_addr ifr_ifru.ifru_addr /* address */#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */#define ifr_flags ifr_ifru.ifru_flags /* flags */#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */#define ifr_data ifr_ifru.ifru_data /* for use by interface */ };/*----------------------------------------------------------------------*//* ifconf structure used in ioctl() call for getting NI configuration *//* using SIOCGIFCONF command *//*----------------------------------------------------------------------*/struct ifconf { int ifc_len; /* size of associated buffer */ union { char *ifcu_buf; struct ifreq *ifcu_req; } ifc_ifcu;#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ };/*----------------------------------------------------------------------*//* Definitions of the flags for the Network Interfaces *//*----------------------------------------------------------------------*/#define IFF_BROADCAST 0x1 /* broadcast flag of the NI */#define IFF_NOARP 0x2 /* no address resolution protocol */#define IFF_LOOPBACK 0x8 /* is a loopback net */#define IFF_POINTTOPOINT 0x10 /* interface is point-to-point link */#define IFF_UP 0x80 /* interface is up */#define IFF_PROMISC 0x100 /* receive all packets */#define IFF_MULTICAST 0x800 /* supports multicast */#define IFF_UNNUMBERED 0x1000 /* unnumbered interface */#define IFF_RAWMEM 0x2000 /* driver will accept mblk link list */#define IFF_EXTLOOPBACK 0x4000 /* Loopback externally */#define IFF_POLL 0x8000 /* interface is a polling type */#define IFF_INITDOWN 0x10000 /* Interface must initialise in DOWN state */#define IFF_POINTOPOINT IFF_POINTTOPOINT /* to conform to UNIX */#define IFF_NODLPIMSG 0x20000 /* DO NOT SEND ANY NON-DLPI messages down */ /* used if running non-ISI DLPI drivers */#define IFF_SENDIFINIT 0x40000 /* IF_INIT ioctl to DLPI driver, which */ /* in turn forces NI_INIT to NI driver */#define IFF_RECEIVEROFF 0x200000 /* Used for turning the receiver off*//*----------------------------------------------------------------------*//* arpreq structure used in ioctl() call to get ARP entries *//*----------------------------------------------------------------------*/struct arpreq { struct sockaddr arp_pa; /* protocol address */ struct sockaddr arp_ha; /* hardware address */ int arp_flags; /* flags */ };#define ATF_INUSE 0x01 /* Entry is in use */#define ATF_COM 0x02 /* Entry is complete */#define ATF_PERM 0x04 /* permanent entry */#define ATF_PUBL 0x08 /* publish entry *//*---------------------------------------------------------------------*//* NI table entry. Used by pNA configuration table and by add_ni(). *//*---------------------------------------------------------------------*/struct ni_init { int (*entry)(); /* address of NI entry point */ int ipadd; /* IP address */ int mtu; /* maximum transmission length */ int hwalen; /* length of hardware address */ int flags; /* intErface flags */ int subnetaddr; /* subnet mask */ int dstipaddr; /* destination ip address */ int reserved[1]; /* reserved for future use */ };/*---------------------------------------------------------------------*//* Routing table entry. Used by pNA configuration table *//*---------------------------------------------------------------------*/struct route { ULONG nwipadd; /* network address */ ULONG gwipadd; /* gateway IP address */ ULONG flags; /* add to Network/host */ ULONG netmask; /* subnet mask - ignored unless RT_MASK flag is set */ };/*---------------------------------------------------------------------*//* Arp table entry. Used by pNA configuration table. *//*---------------------------------------------------------------------*/struct arp { long arp_ipadd; /* IP address of the NI */ char *arp_hadd; /* NI (hardware) address */ long reserved[2]; /* reserved for future use */ };/*---------------------------------------------------------------------*//* Host table entry. Used by pNA configuration table *//*---------------------------------------------------------------------*/struct htentry { unsigned long ht_ipadd; /* IP address of the host */ char *ht_name; /* Name of the host */ long reserved[2]; /* reserved for future use */ };/*----------------------------------------------------------------------*//* Definition of the buffer configuration table *//*----------------------------------------------------------------------*/struct pna_bufcfg { unsigned long pna_nbuffers; /* Number of buffers */ unsigned long pna_bsize; /* Buffer size */ unsigned long reserved[2]; /* Reserved entries */ };/*---------------------------------------------------------------------*//* Definitions for Network Order Conversions Routines *//*---------------------------------------------------------------------*/#if BSP_LITTLE_ENDIAN /*-----------------------------------------------------------------*/ /* Change byte order so the least significant byte is stored at */ /* the lowest address. Unsigned to prevent integer overflow on */ /* i960. Big endian cast unsigned for constant handling of vars. */ /*-----------------------------------------------------------------*/ #define htonl(addr) ( (((ULONG)(addr) & 0x000000FF)<<24) | \ (((ULONG)(addr) & 0x0000FF00)<<8) | \ (((ULONG)(addr) & 0x00FF0000)>>8) | \ (((ULONG)(addr) & 0xFF000000)>>24)) #define ntohl(addr) htonl(addr) #define htons(addr) ( (((USHORT)(addr) & 0x000000FF)<<8) | \ (((USHORT)(addr) & 0x0000FF00)>>8)) #define ntohs(addr) htons(addr)#else #define htonl(a) ((ULONG)(a)) #define ntohl(a) ((ULONG)(a)) #define htons(a) ((USHORT)(a)) #define ntohs(a) ((USHORT)(a))#endif/*----------------------------------------------------------------------*//* class 0 data buffer freeing structure definition (SVR4 feature ) *//*----------------------------------------------------------------------*/#ifndef _FREE_RTN#define _FREE_RTNstruct free_rtn { void (*free_func)(); void *free_arg; };typedef struct free_rtn frtn_t;#endif /* _FREE_RTN *//*----------------------------------------------------------------------*//* msgb structure definition *//*----------------------------------------------------------------------*/#ifndef _MSGB#define _MSGBstruct msgb { struct msgb *b_next; /* next msg on queue */ struct msgb *b_prev; /* previous msg on queue */ struct msgb *b_cont; /* next msg block of msg */ unsigned char *b_rptr; /* first unread data byte in buffer */ unsigned char *b_wptr; /* first unwritten data byte in buffer */ struct datab *b_datap; /* data block */ };typedef struct msgb mblk_t;#endif /* _MSGB *//*----------------------------------------------------------------------*//* datab structure definition *//*----------------------------------------------------------------------*/#ifndef _DATAB#define _DATABstruct datab { struct datab *db_freep; /* used internally */ unsigned char *db_base; /* first byte of buffer */ unsigned char *db_lim; /* last byte+1 of buffer */ unsigned char db_ref; /* count of msgs pointing to this block */ unsigned char db_type; /* msg type */ unsigned char db_class; /* used internally */ unsigned char db_debug; /* debug */ frtn_t db_frtn; };typedef struct datab dblk_t;#endif /* _DATAB *//*----------------------------------------------------------------------*//* STREAMS utilities declarations *//*----------------------------------------------------------------------*/#define datamsg(type) (type == M_DATA || type == M_PROTO \ || type == M_PCPROTO)#define b_size(bp) ((bp)->b_datap->db_lim - (bp)->b_datap->db_base)#define b_len(bp) ((bp)->b_wptr - (bp)->b_rptr)#define b_off(bp) ((bp)->b_rptr - (bp)->b_datap->db_base)#define mtod(bp, t) ((t) (bp)->b_rptr)/***********************************************************************//* Network Interface (NI) related constants and structures. *//***********************************************************************//*---------------------------------------------------------------------*//* Function number for NI services *//*---------------------------------------------------------------------*/#define NI_INIT 0x01 /* NI init call */#define NI_GETPKB 0x02 /* NI get buffer call */#define NI_RETPKB 0x03 /* NI return buffer call */#define NI_SEND 0x04 /* NI send packet call */#define NI_BROADCAST 0x05 /* NI broadcast call */#define NI_POLL 0x06 /* NI poll call */#define NI_IOCTL 0x07 /* NI ioctl call */#define NI_STOP 0x08 /* NI stop call */#define NI_SETUP 0x09 /* NI setup call *//*---------------------------------------------------------------------*//* Structure of pna functions passed to NI during ni_init *//*---------------------------------------------------------------------*/struct ni_funcs { mblk_t *(*allocb)(); /* Allocate pNA buffer */ void (*freeb)(); /* Free Message block */ void (*freemsg)(); /* Free message */ mblk_t *(*esballoc)(); /* Attach message block */ void (*intf_cb)(); /* pNA callback for interface operations */ };/*---------------------------------------------------------------------*//* NI paramter block structure. A pointer to this structure is passed *//* to the NI on each NI service call. *//*---------------------------------------------------------------------*/typedef union nientry { struct niinit { /* NI_INIT */ long (*ap_addr)(); /* pNA entry to receive packet */ long if_num; /* NI interface number */ long ip_addr; /* NI interface IP address */ struct ni_funcs *funcs; /* PNA functions (memory) */ } niinit; struct nigetpkb
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -