📄 if.h
字号:
#define IFS_STARTING 0x1 /* device state = starting */#define IFS_RUNNING 0x3 /* device state = running */#define IFS_HALTING 0x4 /* device state = halting */#define IFS_OWNREQ 0x5 /* device state = ownership requested */#define IFS_OWNREL 0x6 /* device state = ownership released */#define IFS_ENTEREDMOP 0x7 /* device state = mop */#define IFS_XFERCTL 0x1 /* xfer control to next family */#define IFS_RDSTATE 0x1 /* read device state */#define IFS_WRSTATE 0x1 /* set device state */#define IFS_OPEN 0x0#define IFS_OPENDISABLED 0x1 /* Data Port sub-entity states */#define IFS_CALLATTACHED 0x2#define IFS_CLOSEPENDING 0x3#define IFS_ALLOCATE 0x1 /* effectively PhOpenPort */#define IFS_DEALLOCATE 0x1 /* effectively PhClosePort */#define IFS_STARTPORT 0x1 /* effectively GetPhPort */#define IFS_STOPPORT 0x1 /* effectively ReleasePhPort */#define IFS_TXABORT 0x1#define IFS_SETFRAME 0x1#define IFS_SETRXBUFFSIZE 0x1#define IFS_HDLC 0x0#define IFS_SDLC 0x1#define IFS_DDCMP 0x2 /* protocol framing types */#define IFS_BISYNC 0x3#define IFS_GENBYTE 0x4/* error check types - from DSV11 manual */#define IFS_CRC_CCITT_1 0x0 /* CRC-CCITT preset to all 1s */#define IFS_CRC_CCITT_0 0x1 /* CRC-CCITT preset to all 0s */#define IFS_LRC_VRC_ODD 0x2 /* LRC/VRC odd */#define IFS_CRC_16 0x3 /* CRC-16 */#define IFS_VRC_ODD 0x4 /* VRC odd */ #define IFS_VRC_EVEN 0x5 /* VRC even */#define IFS_LRC_VRC_EVEN 0x6 /* LRC/VRC even */#define IFS_CRC_NONE 0x7 /* no error control */struct ifdata { u_char data[128];};/* Structure used in SIOCGIFCONF request. * Used to retrieve interface configuration * for machine (useful for programs which * must know all networks accessible). */struct ifconf { int ifc_len; /* size of associated buffer */ union { caddr_t 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 */};/* * Structure for EEPROM downline upgrades. (Supported by FDDI adapters) */struct ifeeprom { char ife_name[IFNAMSIZ]; /* if name, e.g. "fza0" */ u_char ife_data[64]; /* block of EEPROM data */ u_long ife_offset; /* byte offset from base */ u_long ife_blklen; /* len of EEPROM block */ u_long ife_lastblk; /* True if last block */};#define IFE_NOTLAST 0x0 /* Intermediary block of EEPROM image */#define IFE_LASTBLOCK 0x1 /* Last block of EEPROM image */#define IFE_SUCCESS 0x0 /* Block of EEPROM successfully written */#define IFE_RETRY 0x1 /* Retry last block written */#define IFE_FAIL 0x2 /* Fail entire EEPROM image write sequence *//* * Structure to return module version information *//* * interface statistics structures */struct estat { /* Ethernet interface statistics */ u_short est_seconds; /* seconds since last zeroed */ u_int est_bytercvd; /* bytes received */ u_int est_bytesent; /* bytes sent */ u_int est_blokrcvd; /* data blocks received */ u_int est_bloksent; /* data blocks sent */ u_int est_mbytercvd; /* multicast bytes received */ u_int est_mblokrcvd; /* multicast blocks received */ u_int est_deferred; /* blocks sent, initially deferred */ u_int est_single; /* blocks sent, single collision */ u_int est_multiple; /* blocks sent, multiple collisions */ u_short est_sendfail_bm; /* 0 - Excessive collisions */ /* 1 - Carrier check failed */ /* 2 - Short circuit */ /* 3 - Open circuit */ /* 4 - Frame too long */ /* 5 - Remote failure to defer */ u_short est_sendfail; /* send failures: (bit map)*/ u_short est_collis; /* Collision detect check failure */ u_short est_recvfail_bm; /* 0 - Block check error */ /* 1 - Framing error */ /* 2 - Frame too long */ u_short est_recvfail; /* receive failure: (bit map) */ u_short est_unrecog; /* unrecognized frame destination */ u_short est_overrun; /* data overrun */ u_short est_sysbuf; /* system buffer unavailable */ u_short est_userbuf; /* user buffer unavailable */ u_int est_mbytesent; /* multicast bytes sent */ u_int est_mbloksent; /* multicast blocks sent */};struct dstat { /* DDCMP pt-to-pt interface statistics */ u_short dst_seconds; /* seconds since last zeroed */ u_int dst_bytercvd; /* bytes received */ u_int dst_bytesent; /* bytes sent */ u_int dst_blockrcvd; /* data blocks received */ u_int dst_blocksent; /* data blocks sent */ u_short dst_inbound_bm; /* 0 - NAKs sent, header crc */ /* 1 - NAKs sent, data crc */ /* 2 - NAKs sent, REP response */ u_char dst_inbound; /* data errors inbound: (bit map) */ u_short dst_outbound_bm; /* 0 - NAKs rcvd, header crc */ /* 1 - NAKs rcvd, data crc */ /* 2 - NAKs rcvd, REP response */ u_char dst_outbound; /* data errors outbound: (bit map) */ u_char dst_remotetmo; /* remote reply timeouts */ u_char dst_localtmo; /* local reply timeouts */ u_short dst_remotebuf_bm; /* 0 - NAKs rcvd, buffer unavailable */ /* 1 - NAKs rcvd, buffer too small */ u_char dst_remotebuf; /* remote buffer errors: (bit map) */ u_short dst_localbuf_bm; /* 0 - NAKs sent, buffer unavailable */ /* 1 - NAKs sent, buffer too small */ u_char dst_localbuf; /* local buffer errors: (bit map) */ u_char dst_select; /* selection intervals elapsed */ u_short dst_selecttmo_bm; /* 0 - No reply to select */ /* 1 - Incomplete reply to select */ u_char dst_selecttmo; /* selection timeouts: (bit map) */ u_short dst_remotesta_bm; /* 0 - NAKs rcvd, receive overrun */ /* 1 - NAKs sent, header format */ /* 2 - Select address errors /* 3 - Streaming tributaries */ u_char dst_remotesta; /* remote station errors: (bit map) */ u_short dst_localsta_bm; /* 0 - NAKs sent, receive overrun */ /* 1 - Receive overrun, NAK not sent */ /* 2 - Transmit underruns */ /* 3 - NAKs rcvd, header format */ u_char dst_localsta; /* local station errors: (bit map) */};struct fstat { u_short fst_second; /* seconds since last zeroed */ u_int fst_frame; /* total number of frames seen */ u_int fst_error; /* MAC counter frame error */ u_int fst_lost; /* MAC counter frame count */ u_int fst_bytercvd; /* bytes received */ u_int fst_bytesent; /* bytes sent */ u_int fst_pdurcvd; /* data blocks received */ u_int fst_pdusent; /* data blocks sent */ u_int fst_mbytercvd; /* multicast bytes received */ u_int fst_mpdurcvd; /* multicast blocks received */ u_int fst_mbytesent; /* multicast bytes sent */ u_int fst_mpdusent; /* multicast blocks sent */ u_short fst_underrun; /* transmit underrun error */ u_short fst_sendfail; /* sent failures: (bit map)*/ u_short fst_fcserror; /* FCS check failure */ u_short fst_fseerror; /* frame status error */ u_short fst_pdualig; /* frame alignment error */ u_short fst_pdulen; /* frame length error */ u_short fst_pduunrecog; /* frame unrecognized */ u_short fst_mpduunrecog; /* multicast frame unrecognized */ u_short fst_overrun; /* data overrun */ u_short fst_sysbuf; /* system buffer unavailable */ u_short fst_userbuf; /* user buffer unavailable */ u_short fst_ringinit; /* other station ring reinit. intiated*/ u_short fst_ringinitrcv; /* ring reinitialization initiated */ u_short fst_ringbeacon; /* ring beacon process initiated */ u_short fst_duptoken; /* duplicat token detected */ u_short fst_dupaddfail; /* duplicate address test failures */ u_short fst_ringpurge; /* ring purge errors */ u_short fst_bridgestrip; /* bridge strip errors */ u_short fst_traceinit; /* traces initiated */ u_short fst_tracerecv; /* traces received */ u_short fst_lem_rej; /* LEM reject count */ u_short fst_lem_events; /* LEM events count */ u_short fst_lct_rej; /* LCT reject count */ u_short fst_tne_exp_rej; /* TNE expired reject count */ u_short fst_connection; /* Completed Connection count */ u_short fst_ebf_error; /* Elasticity Buffer Errors */};/* * FDDI MIB structures *//* SMT group */struct fddismt { u_char smt_stationid[8]; /* FDDI station id */ u_short smt_opversionid; /* operation version id */ u_short smt_hiversionid; /* highest version id */ u_short smt_loversionid; /* lowest version id */ short smt_macct; /* number of MACs */ short smt_nonmasterct; /* number of non master port */ short smt_masterct; /* number of master port */ short smt_pathsavail; /* available path type */ short smt_configcap; /* configuration capabilities */ short smt_configpolicy; /* configuration policy */ u_short smt_connectpolicy; /* connection policy */ u_short smt_timenotify; /* neighbor notification prot. time*/ short smt_statusreport; /* status reporting protocol */ short smt_ecmstate; /* state of ECM state machine */ short smt_cfstate; /* CF_state */ short smt_holdstate; /* current state of Hold function */ short smt_remotedisconn; /* remotely disconnection flag */ u_char smt_msgtimestamp[8]; /* timestamp for SMT frames */ u_char smt_trantimestamp[8]; /* timestamp for last event */ u_char smt_setinfo[12]; /* station last parameter change */ u_char smt_lastsetid[8]; /* Last station ID change */}; struct fstatus { short led_state; /* LED State */ short rmt_state; /* RMT state */ short link_state; /* LINK state */ short dup_add_test; /* duplicate address test */ short ring_purge_state; /* ring purge state */ u_long neg_trt; /* Negotiated TRT */ u_char upstream[6]; /* Upstream Neighbor */ u_char una_timed_out; /* una timed out flag */ u_char frame_strip_mode; /* frame strip mode */ u_char claim_token_mode; /* claim token yield mode */ u_char phy_state; /* Physical state */ u_char neighbor_phy_type; /* Neighborshort */ u_char rej_reason; /* reject reason */ u_int phy_link_error; /* phy link error estimate */ u_char ring_error; /* ring error reasons */ u_long t_req; /* TRT request */ u_long tvx; /* TVX value */ u_long t_max; /* TRT maximum */ u_long lem_threshold; /* lem threshold */ u_char mla[6]; /* station physical address */ u_char fw_rev[4]; /* firmware revision */ u_char phy_rev[4]; /* ROM revision */ u_char pmd_type; /* PMD type */ u_char dir_beacon[6]; /* Last Direct Beacon address */ short smt_version; /* SMT version */ short state; /* Adapter State */}; /* MAC group */struct fddimac { short mac_index; /* MAC index */ short mac_fsc; /* MAC frame status capabilities */ u_long mac_gltmax; /* Greastest lower bound of T_max */ u_long mac_gltvx; /* Greastest lower bound of TVX */ short mac_paths; /* path types available */ short mac_current; /* association of the MAC with path*/ u_char mac_upstream[6]; /* upstream neighbor */ u_char mac_oldupstream[6]; /* previous upstream neighbor */ short mac_dupaddrtest; /* duplicate address test */ short mac_pathsreq; /* paths requested */ short mac_downstreamtype; /* downstream PC-type */ u_char mac_smtaddress[6]; /* MAC address for SMT */ u_long mac_treq; /* TRT time */ u_long mac_tneg; /* Neg. TRT time */ u_long mac_tmax; /* max. TRT time */ u_long mac_tvx; /* TVX value */ u_long mac_tmin; /* min. TRT time */ short mac_framestatus; /* current frame status */ int mac_counter; /* frame counters */ int mac_error; /* frame error counters */ int mac_lost; /* frame lost counter */ short mac_rmtstate; /* Ring Management state */ short mac_dupaddr; /* duplicate address flag */ short mac_condition; /* MAC condition */};/* PATH group */struct fddipath { short path_configindex; /* path configuration index */ short path_type; short path_portorder; u_long path_sba; /*synchronous bandwidth allocation*/ short path_sbaoverhead; /* SBA overhead */ short path_status; /* path status */};/* PORT group */struct fddiport { short port_index; /* port index */ short port_pctype; /* value of the port's PC_type */ short port_pcneighbor; /* PC_neighbor of remote port*/ short port_connpolicy; /* connection policies */ short port_remoteind; /* remote MAC indicated */ short port_CEstate; /* Current Configuration state */ short port_pathreq; /* path request */ u_short port_placement; /* upstream MAC */ short port_availpaths; /* available paths */ u_int port_looptime; /* time for MAC loval loop */ u_long port_TBmax; /* TB_max */ short port_BSflag; /* the Break state, BF_flag */ u_int port_LCTfail; /* counter for Link confidence test */ short port_LerrEst; /* Link error estimate */ u_int port_Lemreject; /* Link reject count */ u_int port_Lem; /* Link error monitor count */ short port_baseLerEst; /* value of port Ler Estimate */ u_int port_baseLerrej; /* Ler reject count */ u_int port_baseLer; /* Ler count */ u_char port_baseLerTime[8]; /* Ler timestamp */ short port_Lercutoff; /* error rate cut off limit */ short port_alarm; /* error rate cause alarm generate*/ short port_connectstate; /* connect state */ short port_PCMstate; /* PCM state */ short port_PCwithhold; /* PC_withhold */ short port_Lercondition; /* true if Ler-Est <= Ler_alarm */};/* Attachment group */struct fddiatta { short atta_index; /* attachment index */ short atta_class; /* attachment class */ short atta_bypass; }; /* * interface counter ioctl request */struct ctrreq { char ctr_name[IFNAMSIZ]; /* if name */ char ctr_type; /* type of interface */ union { struct estat ctrc_ether;/* ethernet counters */ struct dstat ctrc_ddcmp;/* DDCMP pt-to-pt counters */ struct fstat ctrc_fddi; /* FDDI counters */ struct fstatus status_fddi; /* FDDI stsatus */ struct fddismt smt_fddi;/* fddi SMT attributes */ struct fddimac mac_fddi;/* fddi MAC attributes */ struct fddipath path_fddi; /* fddi PATH attributes */ struct fddiport port_fddi; /* fddi PORT attributes */ struct fddiatta atta_fddi; /* fddi attatch attributes */ } ctr_ctrs;};#define CTR_ETHER 0 /* Ethernet interface */#define CTR_DDCMP 1 /* DDCMP pt-to-pt interface */#define CTR_FDDI 2 /* FDDI interface */#define FDDIMIB_SMT 3 /* FDDI MIB SMT group */#define FDDIMIB_MAC 4 /* FDDI MIB MAC group */#define FDDIMIB_PATH 5 /* FDDI MIB PATH group */#define FDDIMIB_PORT 6 /* FDDI MIB PORT group */#define FDDIMIB_ATTA 7 /* FDDI MIB Attatchment Group */#define FDDI_STATUS 8 /* FDDI status */#define ctr_ether ctr_ctrs.ctrc_ether#define ctr_ddcmp ctr_ctrs.ctrc_ddcmp#define ctr_fddi ctr_ctrs.ctrc_fddi#define sts_fddi ctr_ctrs.status_fddi#define fmib_smt ctr_ctrs.smt_fddi#define fmib_mac ctr_ctrs.mac_fddi#define fmib_path ctr_ctrs.path_fddi#define fmib_port ctr_ctrs.port_fddi#define fmib_atta ctr_ctrs.atta_fddi#define CTR_HDRCRC 0 /* header crc bit index */#define CTR_DATCRC 1 /* data crc bit index */#define CTR_BUFUNAVAIL 0 /* buffer unavailable bit index */#ifdef KERNEL#include "../net/net/if_arp.h"struct ifnet *ifnet;struct ifnet *if_ifwithaddr(), *if_ifwithnet(), *if_ifwithaf();struct ifnet *if_ifonnetof();#ifdef INETstruct ifqueue ipintrq; /* ip packet input queue */#endif#ifdef BSCstruct ifqueue bscintrq; /* BISYNC packet input queue */#endifstruct ifqueue rawintrq; /* raw packet input queue */struct in_addr if_makeaddr();struct ifaddr *ifa_ifwithaddr(), *ifa_ifwithnet(), *ifa_ifwithaf();#else /* KERNEL */#include <net/if_arp.h>#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -