📄 rsvp_var.h
字号:
#define PKTFLG_Send_RA 0x08 /* Send Router Alert option */#define PKTFLG_NOENCAP 0x10 /* Send packet, without encapsulation machinery checks, eg. diagnostics */ u_char pkt_ttl; /* IP TTL */ enum byteorder { BO_NET, BO_HOST } pkt_order; /* XXX use flags */};#define FORCE_HOST_ORDER(packet) assert((packet)->pkt_order == BO_HOST)#define FORCE_NET_ORDER(packet) assert((packet)->pkt_order == BO_NET)/* * Define packet buffer and packet area */typedef struct { common_header rsvp_common_hdr; char rsvp_objects[MAX_PKT];} rsvp_g;typedef struct { struct packet pa_packet_struct; /* packet structure */ packet_map pa_packet_map; /* base packet map */ FlowDesc pa_packet_fd[MAX_FLWDS-1]; rsvp_g pa_packet_buff; /* packet buffer */} packet_area;/* * Pointers for finding things in RSVP packets, * relative to struct packet * */#define rsvp_R pkt_map->rsvp_timev->timev_R#define rsvp_sess pkt_map->rsvp_session#define rsvp_nflwd pkt_map->rsvp_nlist#define rsvp_scope pkt_map->rsvp_scope_list#define rsvp_phop pkt_map->rsvp_hop#define rsvp_nhop pkt_map->rsvp_hop#define rsvp_errs pkt_map->rsvp_errspec#define rsvp_confrcvr pkt_map->rsvp_confirm#define rsvp_diagnostic pkt_map->rsvp_diag#define rsvp_drespnum pkt_map->rsvp_resplist#define rsvp_dresp(x) pkt_map->rsvp_diag_response[x]#define rsvp_droute pkt_map->rsvp_route#define Resv_pkt struct packet /* Resv message */#define Path_pkt struct packet /* Path message */ #define RTear_pkt struct packet /* ResvTear message */#define PTear_pkt struct packet /* PathTear message */#define RErr_pkt struct packet /* ResvErr message */#define PErr_pkt struct packet /* PathErr message */#define RConf_pkt struct packet /* ResvConf message */#define Dreq_pkt struct packet /* DREQ packet */#define Drep_pkt struct packet /* DREP packet */#define SenderDesc_of(x) &(x)->pkt_map->rsvp_list[0].Sender_list#define SenderDesc_size(sdscp) Object_Size(sdscp->rsvp_stempl) + \ Object_Size(sdscp->rsvp_stspec) + \ Object_Size(sdscp->rsvp_adspec)#define STempl_of(sdscp) ((FILTER_SPEC *)((sdscp)->rsvp_stempl))#define FlowDesc_of(x, i) &(x)->pkt_map->rsvp_list[i].Resv_list#define FlowDesc_size(flwdp) Object_Size(flwdp->rsvp_specp) +\ Object_Size(flwdp->rsvp_filtp)#define rflows(x) FlowDesc_of(x, 0)#define filter_of(flwdp) (flwdp)->rsvp_filtp #define spec_of(flwdp) (flwdp)->rsvp_specp#define Style_of(x) (x)->pkt_map->rsvp_style#define Style(x) ((Style_of(x))?(Style_of(x))->style_word:0)/* * Per-API-client-session internal datastructure */typedef struct { struct packet api_p_packet; /* Packet struct for Path msg */ struct packet api_r_packet; /* Packet struct for Resv msg */ int api_fd; /* file desc for Unix socke */ int api_pid; /* Client process id */ int api_a_sid; /* Client session id */ u_char api_flags; /* flags */ u_char api_protid; /* Protocol Id */ net_addr api_dest; /* Destination addr, port */} api_rec;/* LLDAL (Link-Layer-Dependent Adaptation Layer) macros: * * Define internal rsvpd interface between core RSVP processing * and the LLDAL. * * Core-RSVP builds and maintains reservation state for flows, and it * uses this interface to pass any changes of this state to the LLDAL. * which makes/adjusts the LL-specific reservation state to correspond. * A unique flow is identified by (Dest,NHOP,[Filter_spec]), where * Filter_spec is omitted if the style is shared. */#define LL_NewFlow(i, d, r) ((*if_vec[i].if_LLifv.LL_NewFlow_p) ? \ (*if_vec[i].if_LLifv.LL_NewFlow_p)(d, r): LLDAL_RC_OK)#define LL_ModFlowspec(i, d, r) (*if_vec[i].if_LLifv.LL_ModFlowspec_p) ?\ (*if_vec[i].if_LLifv.LL_ModFlowspec_p)(d, r) : LLDAL_RC_OK#define LL_ModFilter(i, d, r) ((*if_vec[i].if_LLifv.LL_ModFilter_p) ?\ (*if_vec[i].if_LLifv.LL_ModFilter_p)(d, r) : LLDAL_RC_OK)#define LL_DelFlow(i, d, r) ((*if_vec[i].if_LLifv.LL_DelFlow_p) ? \ (*if_vec[i].if_LLifv.LL_DelFlow_p)(d, r) : LLDAL_RC_OK)#define LL_Advertise(i, d, p) ((*if_vec[i].if_LLifv.LL_Advertise_p) ? \ (*if_vec[i].if_LLifv.LL_Advertise_p)(i, d, p) : LLDAL_RC_OK)#define LL_GetInfo(i, d, r) ((*if_vec[i].if_LLifv.LL_GetInfo_p) ? \ (*if_vec[i].if_LLifv.LL_GetInfo_p)(d, r) : LLDAL_RC_OK)#define LL_BugDump(i, d) ((*if_vec[i].if_LLifv.LL_BugDump_p) ? \ (*if_vec[i].if_LLifv.LL_BugDump_p)(i, d) : LLDAL_RC_OK)/* * Return codes from LLDAL interface calls. */#define LLDAL_RC_OK 0 /* Function completed synchronously */#define LLDAL_RC_LATER +1 /* Function will complete asynch'ly, and* * LLDAL will invoke callback routine. */#define LLDAL_RC_ERROR -1 /* Synch'ous error. Check rsvp_errno *//* Per-Link-Layer-Technology interface vector * * Defines internal rsvpd interface between core RSVP processing * and the Link-Layer-Dependent Adaptation Layer (LLDAL) * * Core-RSVP builds and maintains reservation state for flows, and it * uses this interface to pass any changes of this state to the LLDAL. * which makes/adjusts the LL-specific reservation state to correspond. * A unique flow is identified by (Dest,NHOP,[Filter_spec]), where * Filter_spec is omitted if the style is shared. * * LLDAL_calls_t defines vector of entry points to LLDAL interface * routines, for a particular interface. */typedef struct { int (*LL_NewFlow_p)(Session *, RSB *); int (*LL_ModFlowspec_p)(Session *, RSB *); int (*LL_ModFilter_p)(Session *, RSB *); int (*LL_DelFlow_p)(Session *, RSB *); int (*LL_Advertise_p)(int, Session *, PSB *); int (*LL_GetInfo_p)(Session *, RSB *); int (*LL_BugDump_p)(int, Session *);} LLDAL_calls_t;/* * Per-phyint internal data structure */typedef struct { char if_name[IFNAMSIZ]; /* Interface name */ int if_index; /* Interface number */ int if_unicast; /* The interface to send/recv a unicast packet for this interface. For a regular network interface this is itself. For a vif, it is the interface on which the vif is layered. */ u_char if_up; /* Boolean: Traffic Control up */ u_char if_flags;#define IF_FLAG_IFF_UP 0x01 /* Iface up (Must match IFF_UP) */#define IF_FLAG_IFF_MC 0x02 /* Iface supports multicast */#define IF_FLAG_UseUDP 0x10 /* Interface uses UDP encaps */#define IF_FLAG_Police 0x20 /* Police all data rcvd on iface*/#define IF_FLAG_Intgrty 0x40 /* INTEGRITY required */#define IF_FLAG_Disable 0x80 /* Disable RSVP */ u_char if_udpttl; /* TTL for sending UDP encaps */ net_if if_addr; /* Interface IP address */ u_int8_t prefix; /* CIDR prefix */ u_int32_t if_Rdefault; /* Default refresh rate R to snd*//* * Followinq values are used by TC interface module to update general * path characteristics. This is not strictly RSVP... */ float32_t if_path_bw; /* Path bandwidth */ u_int32_t if_min_latency; /* Min latency */ u_int32_t if_path_mtu; /* XXX temporary */ LLDAL_calls_t if_LLifv; /* LL interface vector */#ifdef STATS RSVPstat if_stats; /* Statistics table */#endif} if_rec;#define IF_UNICAST(x) (if_vec[x].if_unicast)#define IF_FLAGS(v) (if_vec[v].if_flags)#define IF_NAME(v) (if_vec[v].if_name)#define IF_DOWN(x) (!(if_vec[x].if_flags & IF_FLAG_IFF_UP))#ifdef STATS#define Incr_ifstats(i, val) if_vec[i].if_stats.##val++;#else#define Incr_ifstats(i, val)#endif/* * Link Layer (police) flags */#define TCF_E_POLICE 0x01 /* Entry policing */#define TCF_M_POLICE 0x02 /* Merge-point policing */#define TCF_B_POLICE 0x04 /* Branch-point policing */#define TCF_MTUNNEL 0x08 /* this VIF is a TUNNEL *//* * Timer event type codes */#define TIMEV_PATH 1 /* Generate Path refresh */#define TIMEV_RESV 2 /* Generate Resv refresh */#define TIMEV_API 3 /* Generate API refresh */#define TIMEV_LocalRepair 4 /* Path local repair delay */#ifdef RTAP#define TIMEV_RTAPsleep 5 /* RTAP sleep command */#define TIMEV_RTAPdata 6 /* RTAP send-data time */#endif/* * INTEGRITY Key Association table entry */typedef struct { u_char kas_keyid[KEYID_LENG]; /* Key id */ u_int32_t kas_seqno[SEQNO_LENG]; /* Last seq # received */ char kas_if; /* Sending interface | -1 */ char kas_algno; /* Algorithm number */#define INTGR_MD5 1 char kas_unused; char kas_keylen; /* Key length (0=> empty entry) */ u_char kas_key[MD5_LENG];} KEY_ASSOC;/* * Define logging levels (These are taken from syslog.h; repeated here * for convenience). */#define LOG_CRIT 2 /* critical conditions */#define LOG_ERR 3 /* error conditions */#define LOG_WARNING 4 /* warning conditions */#define LOG_NOTICE 5 /* normal but signification condition */#define LOG_INFO 6 /* informational */#define LOG_DEBUG 7 /* debug-level messages */#define LOG_HEXD 8 /* include hex dumps of interface events *//* Debug Mask bits */#define DEBUG_IO 0x01 /* Log packets sent & received */#define DEBUG_DS_DUMP 0x02 /* Dump data structures */#define DEBUG_EVENTS 0x04 /* Log API, kernel reservation events */#define DEBUG_ROUTE 0x08 /* Log routes */#define DEBUG_RSRR 0x08 /* Log multicast routes */#define DEBUG_MCAST_STATE 0x10 /* Multicast RSVP state (to dmap) */#define DEBUG_TIMERS 0x20 /* Timer events */#define DEBUG_ALL 0xff#define LOG_ALWAYS 0 /* special value for log severity level *//* Defaults for logging controls * Foreground (-D) operation: Defaults to lots of logging. * Background operation: Defaults to only info & error msgs */#define FG_DFLT_DEBUG_MASK DEBUG_EVENTS|DEBUG_DS_DUMP|DEBUG_IO #define FG_DFLT_LOGGING_LEVEL LOG_DEBUG#ifdef ISI_TEST#define BK_DFLT_DEBUG_MASK FG_DFLT_DEBUG_MASK#define BK_DFLT_LOGGING_LEVEL FG_DFLT_LOGGING_LEVEL#else#define BK_DFLT_DEBUG_MASK 0 #define BK_DFLT_LOGGING_LEVEL LOG_INFO#endif /* ISI_TEST *//* Debugging events */enum debug_events { /* Must match Log_Event_Types[] in rsvp_debug.c */ LOGEV_Recv_UDP, LOGEV_Recv_Raw, LOGEV_Recv_API, LOGEV_Send_UDP, LOGEV_Send_Raw, LOGEV_Send_RandU, LOGEV_API_regi, LOGEV_API_resv, LOGEV_API_close, LOGEV_API_upcall, LOGEV_API_debug, LOGEV_API_stat, LOGEV_TC_addflow, LOGEV_TC_modflow, LOGEV_TC_delflow, LOGEV_TC_addfilt, LOGEV_TC_delfilt, LOGEV_ignore, LOGEV_iserr };/* * Packet parse internal error codes */#define PKT_OK 0#define PKT_ERR_LENGTH -1 /* Len in hdr != real packet length */#define PKT_ERR_VERSION -2 /* Unknown version */#define PKT_ERR_CKSUM -3 /* Bad checksum */#define PKT_ERR_INTEGRITY -4 /* INTEGRITY bad or missing */#define PKT_ERR_NOINTASS -5 /* INTEGRITY association unknown */#define PKT_ERR_MSGTYPE -6 /* Unknown message type */#define PKT_ERR_BADOBJ -7 /* Object should not appear in msg type */#define PKT_ERR_MISSOBJ -8 /* Missing required object */#define PKT_ERR_OBJLEN -9 /* Illegal object length */#define PKT_ERR_UNKCLASS -10 /* Unknown object class */#define PKT_ERR_ORDER -11 /* Violation of required object order */#define PKT_ERR_NOSESS -12 /* Missing SESSION object */#define PKT_ERR_NOSTYLE -13 /* Missing STYLE */#define PKT_ERR_BADSTYL -14 /* Unknown style id */#define PKT_ERR_NOFILT -14 /* Missing FILTER_SPEC */#define PKT_ERR_NUMFLOW -16 /* Wrong # flow descriptors */#define PKT_ERR_BADLIH -17 /* Logical Interface Handle out of range*/#define PKT_ERR_BADSPORT -18 /* SrcPort ! = 0 but DstPort == 0 */#define PKT_ERR_HOPZERO -19 /* N/PHOP IP addr is zero */#define PKT_ERR_TTLZERO -20 /* Path message had TTL = 0 */#define PKT_ERR_REPLAY -21 /* INTEGRITY seq# replayed *//* * XXX should be in rsvp_mac.h */#define IsPath(x) ((x)->rsvp_msgtype == RSVP_PATH||\ (x)->rsvp_msgtype == RSVP_PATH_TEAR ||\ (x)->rsvp_msgtype == RSVP_PATH_ERR)#define IsResv(x) (!IsPath(x)) && (!IsDiag(x)) /* May not always be true.. */#define IsDiag(x) ((x)->rsvp_msgtype == RSVP_DREQ ||\ (x)->rsvp_msgtype == RSVP_DREP)#endif /* __rsvp_var_h__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -