?? pna.h
字號:
/*----------------------------------------------------------------------*//* Message block statistics *//*----------------------------------------------------------------------*/struct mbstat { long mb_bufclasses; /* Number of buffer classes */ long mb_mblks; /* Number of mblks configured */ long mb_free; /* Number of available mblks */ long mb_wait; /* Number of times waited for mblk */ long mb_drops; /* Number of times failed to get mblk */ };/*----------------------------------------------------------------------*//* Data blocks statistics *//*----------------------------------------------------------------------*/struct dbstat { long db_size; /* Size of data block */ long db_dblks; /* Number of data blocks */ long db_free; /* number of free data blocks */ long db_wait; /* Number of times waited to get dblk */ long db_drops; /* Number of times failed to get dblk */ long db_reserved[2]; /* Reserved entries */ };/*----------------------------------------------------------------------*//* Structure to request data block statistics using ioctl call *//*----------------------------------------------------------------------*/struct dbreq { long size; struct dbstat *dsp; };/*----------------------------------------------------------------------*//* rtentry structure used in ioctl() call to communicate routes to *//* pNA routing table. rt_netmask is ignored unless the RTF_MASK is *//* set in the rt_flags entry. If rt_netmask is not filled in then pNA+ *//* will compute a mask based on the class of the address. Optionally *//* rt_ifno may be used to specify the outgoing interface of a route. *//* This is helpful with unnumbered links where the outgoing interface *//* cannot be defined by just the interface IP address. *//*----------------------------------------------------------------------*/struct rtentry { struct sockaddr rt_dst; /* key to access the route*/ struct sockaddr rt_gateway; /* route gateway */ unsigned short rt_flags; /* host/net */ unsigned short rt_reserved; /* reserved */ unsigned long rt_netmask; /* netmask of route - ignored unless RTF_MASK is set in rt_flags */ long rt_ifno; /* interface no for local interface - ignored unless RTF_INTF is set in rt_flags */ unsigned long rt_reserved2[2];/* reserved */ };#define RTF_HOST 0x1 /* host entry (net otherwise) */#define RTF_GATEWAY 0x2 /* destination is a gateway */#define RTF_INTF 0x40 /* route via a given intf */#define RTF_MASK 0x80 /* Uses Subnet version *//*---------------------------------------------------------------------*//* Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. *//*---------------------------------------------------------------------*/struct ip_mreq { struct in_addr imr_mcastaddr; /* IP multicast address of group */ struct in_addr imr_interface; /* local IP address of interface */};/*--------------------------------------------------------------------------*//* Argument structure for IP_ADD_MEMBERSHIP_IFNO and IP_DROP_MEMBERSHIP_IFNO*//*--------------------------------------------------------------------------*/struct ip_mreq_intf { struct in_addr imrif_mcastaddr; /* IP multicast address of group */ long imrif_ifno; /* local interface number */};/*----------------------------------------------------------------------*//* ifreq structure used in ioctl() call for getting NI characteristics *//*----------------------------------------------------------------------*/struct ifreq { 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_POINTTOPOINT 0x10 /* interface is point-to-point link */#define IFF_UP 0x80 /* interface is up */#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_POINTOPOINT IFF_POINTTOPOINT /* to conform to UNIX *//*----------------------------------------------------------------------*//* 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 */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -