📄 pna.h
字号:
{ /* NI_GETPBK */ long count; /* size of the buffer */ char *hwa_ptr; /* Ptr to dest hardware address */ long if_num; /* NI interface number */ } nigetpkb; struct niretpkb { /* NI_RETPBK */ char *buff_addr; /* Address of the buffer */ long if_num; /* NI interface number */ } niretpkb; struct nisend { /* NI_SEND */ char *buff_addr; /* Address of the packet buffer */ long count; /* Size of the packet */ long type; /* Type of the packet (IP/ARP) */ long if_num; /* NI interface number */ char *hwa_ptr; /* Ptr to dest hardware address */ } nisend; struct nibrdcast { /* NI_BRDCAST */ char *buff_addr; /* Address of the packet buffer */ long count; /* Size of the packet */ long type; /* Type of the packet (ARP/IP) */ long if_num; /* NI interface number */ } nibrdcast; struct nipoll { long if_num; /* NI interface number */ } nipoll; struct niioctl { long cmd; /* ioctl command */ long *arg; /* Pointer to ioctl argument */ long if_num; } niioctl; } nientry;/*---------------------------------------------------------------------*//* NI map multicast structure. A pointer to this structure is passed *//* to the NI to map a protocol specific multicast address to a hardware*//* specific multicast address. E.g .to map an IP multicast address to *//* ethernet multicast. *//*---------------------------------------------------------------------*/struct ni_map_mcast { int type; /* Protocol Type */ char prtladdr[14]; /* Protocol Address */ char hdwraddr[14]; /* Hardware address */ };/***********************************************************************//* pNA+ Fatal Error Codes *//***********************************************************************/#define FAT_INSUFFMEM 0x5F01 /* Insufficient memory allocated by */ /* NC_DATASIZE or REGION 0 too small */#define FAT_NRT 0x5F02 /* The number of initial routing table */ /* entries specified exceeds NC_NROUTE */#define FAT_NNI 0x5F03 /* The number of initial NI table */ /* entries specified exceeds NC_NNI */#define FAT_NIHSIZE 0x5F04 /* Invalid NI address */#define FAT_NIMTU 0x5F05 /* Invalid MTU for NI */#define FAT_PNAMEM 0x5F06 /* pNA+ memory error */#define FAT_PNATASK 0x5F07 /* PNAD task creation error */#define FAT_PNAINIT 0x5F08 /* pNA+ initialization error */#define FAT_NIINIT 0x5F09 /* NI initialization error */#define FAT_RTINIT 0x5F0A /* Routing table initialization error */#define FAT_ARPINIT 0x5F0B /* ARP table initialization error */#define FAT_TIMERINIT 0x5F0C /* PNAD timer initialization error */#define FAT_EVENT 0x5F0D /* PNAD event error */#ifndef FAT_CHKSUM /* To avoid collision with psos.h */#define FAT_CHKSUM 0x5F0E /* pNA+ Checksum error */#endif/***********************************************************************//* pNA+ Error Codes returned via errno *//***********************************************************************/#undef EINTR#define EINTR 0x5004 /* Interrupted system call */#undef EIO#define EIO 0x5005 /* I/O error */#undef ENXIO#define ENXIO 0x5006 /* No such address */#undef EBADS#define EBADS 0x5009 /* The socket descriptor is invalid */#undef ENOMEM#define ENOMEM 0x500C /* Not enough memory */#undef E_ACCESS#define E_ACCESS 0x500D /* Permission denied */#undef EEXIST#define EEXIST 0x5011 /* Entry exists */#undef EINVALID#define EINVALID 0x5016 /* An argument is invalid */#undef ENFILE#define ENFILE 0x5017 /* An internal table has run out of */ /* space */#undef EPIPE#define EPIPE 0x5020 /* The connection is broken */#undef EWOULDBLOCK#define EWOULDBLOCK 0x5023 /* This operation would block and */ /* the socket is non-blocking */#undef EINPROGRESS#define EINPROGRESS 0x5024 /* The socket is non-blocking and the */ /* connection cannot be completed */ /* immediately */#undef EALREADY#define EALREADY 0x5025 /* The socket is non-blocking and a */ /* previous connection attempt has */ /* not yet completed */#undef ENOTSOCK#define ENOTSOCK 0x5026 /* Socket operation on a non-socket */#undef EDESTADDRREQ#define EDESTADDRREQ 0x5027 /* The destination address is invalid */#undef EMSGSIZE#define EMSGSIZE 0x5028 /* Message too long */#undef EPROTOTYPE#define EPROTOTYPE 0x5029 /* Protocol wrong type for socket */#undef ENOPROTOOPT#define ENOPROTOOPT 0x502A /* Protocol not available */#undef EPROTONOSUPPORT#define EPROTONOSUPPORT 0x502B /* Protocol not supported */#undef ESOCKTNOSUPPORT#define ESOCKTNOSUPPORT 0x502C /* Socket type not supported */#undef EOPNOTSUPP#define EOPNOTSUPP 0x502D /* Operation not supported on socket */#undef EPFNOSUPPORT#define EPFNOSUPPORT 0x502E /* Protocol family not supported */#undef EAFNOSUPPORT#define EAFNOSUPPORT 0x502F /* Address family not supported */#undef EADDRINUSE#define EADDRINUSE 0x5030 /* Address is already in use */#undef EADDRNOTAVAIL#define EADDRNOTAVAIL 0x5031 /* Address not available */#undef ENETDOWN#define ENETDOWN 0x5032 /* Network is down */#undef ENETUNREACH#define ENETUNREACH 0x5033 /* Network is unreachable */#undef ENETRESET#define ENETRESET 0x5034 /* Network dropped connection on reset */#undef ECONNABORTED#define ECONNABORTED 0x5035 /* The connection has been aborted */ /* by the peer */#undef ECONNRESET#define ECONNRESET 0x5036 /* The connection has been reset */ /* by the peer */#undef ENOBUFS#define ENOBUFS 0x5037 /* An internal buffer is required, */ /* but cannot be allocated */#undef EISCONN#define EISCONN 0x5038 /* The socket is already connected */#undef ENOTCONN#define ENOTCONN 0x5039 /* The socket is not connected */#undef ESHUTDOWN#define ESHUTDOWN 0x503A /* Can't send after socket shutdown */#undef ETOOMANYREFS#define ETOOMANYREFS 0x503B /* Too many references: can't splice */#undef ETIMEDOUT#define ETIMEDOUT 0x503C /* Connection timed out */#undef ECONNREFUSED#define ECONNREFUSED 0x503D /* The attempt to connect was refused */#undef EHOSTDOWN#define EHOSTDOWN 0x5040 /* Host is down */#undef EHOSTUNREACH#define EHOSTUNREACH 0x5041 /* The destination host could not be */ /* reached from this node */#undef ENOTEMPTY#define ENOTEMPTY 0x5042 /* Directory not empty */#undef ENIDOWN#define ENIDOWN 0x5046 /* NI_INIT returned -1 */#undef ENMTU#define ENMTU 0x5047 /* The MTU is invalid */#undef ENHWL#define ENHWL 0x5048 /* The hardware length is invalid */#undef ENNOFIND#define ENNOFIND 0x5049 /* The route specified cannot be found */#undef ECOLL#define ECOLL 0x504A /* Collision in select call; these */ /* conditions have already been */ /* selected by another task */#undef ETID#define ETID 0x504B /* The task id is invalid *//***********************************************************************//* pNA+ System Calls (defined in pna.s) *//***********************************************************************/long accept(int s, struct sockaddr *addr, int *addrlen);long add_ni(struct ni_init *ni);long bind(int s, struct sockaddr const *addr, int addrlen);long connect(int s, struct sockaddr const *addr, int addrlen);long getpeername(int s, struct sockaddr *addr, int *addrlen);long getsockname(int s, struct sockaddr *addr, int *addrlen);long getsockopt(int s, int level, int optname, char *optval, int *optlen);long get_id(ULONG *userid, ULONG *groupid, ULONG);long listen(int s, int backlog);long recv(int s, char *buf, int len, int flags);long recvfrom(int s, char *buf, int len, int flags, struct sockaddr *from, int *fromlen);long recvmsg(int s, struct msghdr *msg, int flags);long select(int width, struct fd_set *readset, struct fd_set *writeset, struct fd_set *exceptset, struct timeval *timeout);long send(int s, char const *buf, int len, int flags);long sendmsg(int s, struct msghdr const *msg, int flags);long sendto(int s, char const *buf, int len, int flags, struct sockaddr const *to, int tolen);long setsockopt(int s, int level, int optname, char const *optval, int optlen);long set_id(ULONG userid, ULONG groupid, ULONG);int shr_socket(int s, int tid);long shutdown(int s, int how);int socket(int domain, int type, int protocol);/* Rename ioctl & close as they clash with identically named functions for files. */long closesocket(int s);long ioctlsocket(int s, int cmd, char *arg);mblk_t *pna_allocb(int size, int pri);mblk_t *pna_esballoc(unsigned char *base, int size, int pri, frtn_t *frtn);void pna_freeb(mblk_t *bp);void pna_freemsg(mblk_t *mp);void InstallNi (int (*) (), int, int, int, int, int, int);#define MAXHOSTNAMELEN 31 /*excluding terminator*/extern int gethostname (char */*name*/, int /*name_len*/);extern int set_hostentry (ULONG /*addr*/, char const */*name*/); /*ENAME, ENFILE*/extern int del_hostentry (ULONG /*addr*/); /*ENFIND*/extern int get_hentbyaddr (ULONG /*addr*/, char */*name*/); /*ENFIND*/extern int get_hentbyname (char const */*name*/, ULONG */*addr*/); /*ENFIND*/ /*all these return 0, or -1 on error and set errno*/#if defined(__cplusplus)}#endif#endif /* _PNA_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -