📄 rsvp_var.h
字号:
/* * @(#) $Id: rsvp_var.h,v 1.1.1.1 2000/05/08 22:51:24 wenqing Exp $ *//**************************************************************************** RSVPD -- ReSerVation Protocol Daemon USC Information Sciences Institute Marina del Rey, California Original Version: Shai Herzog, Nov. 1993. Current Version: Steven Berson & Bob Braden, May 1996. Copyright (c) 1996 by the University of Southern California All rights reserved. Permission to use, copy, modify, and distribute this software and its documentation in source and binary forms for any purpose and without fee is hereby granted, provided that both the above copyright notice and this permission notice appear in all copies. and that any documentation, advertising materials, and other materials related to such distribution and use acknowledge that the software was developed in part by the University of Southern California, Information Sciences Institute. The name of the University may not be used to endorse or promote products derived from this software without specific prior written permission. THE UNIVERSITY OF SOUTHERN CALIFORNIA makes no representations about the suitability of this software for any purpose. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Other copyrights might apply to parts of this software and are so noted when applicable.********************************************************************/#ifndef __rsvp_var_h__#define __rsvp_var_h__/* Times */#define MIN_TIMER_PERIOD 200 /* the minimal time interval */#define MAX_TIMER_Q 1000 /* the maximal timer queue len */#define LOCAL_REPAIR_W 2000 /* W = Timeout for path local repair */#define REFRESH_DEFAULT 30000 /* Default refresh time in protocol */#define API_REFRESH_T 30000 /* Refresh time for pseudo-msgs from API*/#define REFRESH_SLEW_MAX 0.30 /* SlewMax = Max increase rate for R */#define K_FACTOR 3 /* K = Timeout factor */#define Kb_FACTOR 2 /* Kb = Blockade state timeout factor */#define REFRESH_FAST_T 1000 /* Fast refresh interval */#define REFRESH_FAST_N 3 /* No. of fast refresh packets to send */#define DUMP_DS_TIMO 30000 /* msec between state dumps to log *//* TTLs */#define RSVP_TTL_MAX 63 /* Max TTL for mcasting Path, etc msgs */#define RSVP_TTL_ENCAP 1 /* TTL for UDP encapsulation *//* Limits */#define SESS_HASH_SIZE 293 /* Entries in session hash table */#define MAX_SESSIONS 200 /* max # API sessions */#define API_TABLE_SIZE (2*MAX_SESSIONS) /* Double-size hash table */#define KEY_TABLE_SIZE 40 /* Max # key association table entries */ /* Handle multiple interfaces, multiple keys, and 2 directions */#define MAX_PKT 4000 /* temporary maximum packet length */#if defined (freebsd)#define MAX_SOCK_CTRL 50 /* IP_RECVIF support, control structure */ /* for received phys. interface number */#endif#define IPUDP_HDR_AREA_SIZE 32 /* Room to build IP and UDP headers */#define MAX_FLWDS 100 /* Max # flow descriptors allowed in map*/#define MAX_LOG_SIZE 400000#define MIN_INTGR_SEQ_NO 3 /* Always-accept threshold for INTEGRITY*/ /* sequence number. *//* Types */#define BMP_SIZE (64/NBBY) /* 64 bits */typedef struct bitmap { unsigned char bmp[BMP_SIZE];} bitmap;extern int bmp_equ(bitmap *, bitmap *);extern int bmp_zero(bitmap *);extern void bmp_rst(bitmap *);extern void bmp_set(bitmap *, int);extern void bmp_clr(bitmap *, int);extern int bmp_tst(bitmap *, int);extern bitmap * bmp_shift(bitmap *, bitmap *, int);extern bitmap * bmp_create(u_long, bitmap *);/*************************************************************** * RSVP state: Data Structures * ***************************************************************//* FiltSpecStar (FILTER_SPEC*): variable-length list of * (filter spec, info) pairs. In RSB's the info is * the time-to-die; in TCSB's it is the Fhandle. * * WF: 1 entries with NULL pointer. * FF: 1 entry * SE: n entries */typedef struct filtstar { u_int16_t fst_size; /* Max number of filter specs */ u_int16_t fst_count; /* Number of filter specs */ struct fst_pair { FILTER_SPEC *fst_filtp; /* Ptr to FILTER SPEC */ u_int32_t fst_info; /* Info */ } fst_p[1]; /* Var-len list of pairs*/} FiltSpecStar;#define fst_filtp0 fst_p[0].fst_filtp#define fst_Filtp(i) fst_p[(i)].fst_filtp#define fst_Filt_TTD(i) fst_p[(i)].fst_info#define SizeofFiltSpecStar(n) (sizeof(FiltSpecStar)+(n-1)*sizeof(struct fst_pair))/* Fobject: Framed object, i.e., object preceded by queueing pointer. * */typedef struct Fobject_stru { struct Fobject_stru *Fobj_next; /* Next in list */ Object_header Fobj_objhdr; /* Object header */ /* followed by object body */} Fobject;/* * RSB: Reservation state block. */typedef struct resv { struct resv *rs_next; RSVP_HOP rs_rsvp_nhop; /* IP addr of next RSVP hop */ /* If addr==0(API) => LIH= Iapp */ FiltSpecStar *rs_filtstar; /* Ptr to var-len filt spec list*/ u_char rs_OIf; /* Outgoing Interface */ u_char rs_flags; /* */#define RSB_FLAG_MERGED 0x01 /* Comm flag: >1 RSB merged */ u_short rs_rsrr_flags; /* RSRR flags */ style_t rs_style; /* Style opt vector */ FLOWSPEC *rs_spec; /* ptr to FLOWSPEC object */ FLOWSPEC *rs_fwd_spec; /* FLOWSPEC to be forwarded|NULL*/ FLOWSPEC *rs_oldspec; /* ptr to previous FLOWSPEC */ SCOPE *rs_scope; /* WF scope for this resv */ CONFIRM *rs_confirm; /* Confirmation */ u_int32_t rs_ttd; /* Time-to-die for this state */ Fobject *rs_UnkObjList; /* List of Unknown objs to fwd */ Fobject *rs_Frpolicy; /* List of POLICY DATA objects */} RSB;#define rs_nhop rs_rsvp_nhop#define rs_filter0 rs_filtstar->fst_p[0].fst_filtp#define rs_fcount rs_filtstar->fst_count#define filt_ttd fst_info#define rs_Filtp(i) rs_filtstar->fst_p[(i)].fst_filtp#define rs_Filt_TTD(i) rs_filtstar->fst_p[(i)].fst_info/* * PSB: Path State Block, per-sender * * PSBs are chained off d_PSB_list head in session block. * They are chained in order by sender IP address within * a given PHOP address. */typedef struct sender { struct sender *ps_next; /* next PSB for same session */ SENDER_TEMPLATE *ps_templ; /* Sender template */ SENDER_TSPEC *ps_tspec; /* Sender Tspec */ RSVP_HOP ps_rsvp_phop; /* Previous hop */ ADSPEC *ps_adspec; /* OPWA Adspec */ ADSPEC *ps_newadspec; /* Updated Adspec */ u_char ps_ip_ttl; /* IP TTL from Path msg */ u_char ps_unused1; u_char ps_originvif; /* Origin vif if sender is API */ char ps_in_if; /* IncInterface from routing */ bitmap ps_outif_list; /* bitmap => OutInterface_list */ u_char ps_flags;#define PSBF_NonRSVP 0x01 /* Non-RSVP hop experienced */#define PSBF_E_Police 0x04 /* Entry policing for sender */#define PSBF_LocalOnly 0x08 /* Can only match local Resv */#define PSBF_UDP 0x10 /* This sender needs UDP encaps.*/#define PSBF_Prefr_need 0x20 /* (Path) Refresh Needed */#define PSBF_Rrefr_need 0x40 /* (Resv) Refresh Needed */#define PSBF_InScope 0x80 /* Used to form union of scopes */ u_char ps_unused; u_short ps_rsrr_flags; /* RSRR flags */#define PSBF_RSRR_NOTIFY 0x01 /* RSRR Notification flag */ u_int32_t ps_ttd; /* Time-to-die for the state */ Fobject *ps_UnkObjList; /* List: unknown objects to fwd */ Fobject *ps_Frpolicy; /* POLICY_DATA object ptr */ struct sender *ps_1stphop; /* Ptr to first sender for PHOP */ FLOWSPEC *ps_resv_spec; /* Last Resv refresh flowspec to*/ /* this sender/phop */ /* For wildcard resv, ps_resv_spec is defined only when * ps==ps_1stphop */ /* * Following fields are effectively a BSB * (Blockade State Block) */ FLOWSPEC *ps_BSB_Qb; /* Blockade flowspec */ int ps_BSB_Tb; /* Blockade timer = # R cycles */ } PSB;#define ps_phop ps_rsvp_phop#define IsHopAPI(x) net_addr_equal(hop_addr(x),&api_address)#define IsAddrAPI(x) net_addr_equal(x,&api_address)#define IsNumAPI(x) ((x) == api_num)/* * Session: Per-session internal data structure */typedef struct Dest { struct Dest *d_next; /* next dest */ SESSION *d_session; /* SESSION => DestAddr, DstPort */ u_char d_flags; /* flags for the dest */#define SESSF_HaveScope 0x01 /* Scope union has been computed*/ struct d_refr_vals { TIME_VALUES d_timeval; /* Time values for sending */ int d_fast_n; /* # fast refreshes left to send */ /* Can add other values here for controlling adaptation of R */ } d_refr_p; /* For path state */ struct d_refr_vals d_refr_r; /* For resv state */ bitmap d_r_incifs; /* Incoming ifaces for Resv refresh*/ PSB *d_PSB_list; /* List of senders (path state) */ RSB *d_RSB_list; /* List of RSB's -- requests */ void **d_LLB_listv; /* Per-OI lists of LL blocks */} Session;#define d_timevalp d_refr_p.d_timeval#define d_timevalr d_refr_r.d_timeval#define d_Rtimop d_timevalp.timev_R#define d_Rtimor d_timevalr.timev_R /* * Define map vector * * Used to construct a map of objects in a packet. When a packet * is received, a commmon routine parses it (and converts its * byte order if needed), and builds a map vector with * pointers to the objects; unused pointers are NULL. The * parse depends upon the message type. * * To send a packet, rsvpd first builds a map pointing to the * required objects. Then a common routine builds the packet * (converting the byte order if needed) from the map. *//* First define elements of lists within map vector */typedef struct { /* For Path messages */ SENDER_TEMPLATE *rsvp_stempl; SENDER_TSPEC *rsvp_stspec; ADSPEC *rsvp_adspec;} SenderDesc;typedef struct { /* For Resv messages */ FLOWSPEC *rsvp_specp; /* Flowspec */ FILTER_SPEC *rsvp_filtp; /* Filter spec */} FlowDesc;/* * Now define map vector itself. This vector is ordered to match * the order of objects according to the Functional Spec document. */#define MAX_LIST 100 /* For in-stack allocation */typedef struct { DIAGNOSTIC *rsvp_diag; /* DIAGNOSTIC header object */ INTEGRITY *rsvp_integrity; SESSION *rsvp_session;/**** SESSION_GROUP *rsvp_sess_grp; (OBSOLETE) */ RSVP_HOP *rsvp_hop; TIME_VALUES *rsvp_timev; ERROR_SPEC *rsvp_errspec; Fobject *rsvp_dpolicy; /* Policy data */ CONFIRM *rsvp_confirm; SCOPE *rsvp_scope_list; STYLE *rsvp_style; ROUTE *rsvp_route; /* ROUTE obj for diagnostics*/ DIAG_RESPONSE *rsvp_diag_response; /* diagnostic response list */ int rsvp_resplist; /* # of diagnostic responses */ int rsvp_msgtype; /* (in your face...) */ int rsvp_flags; Fobject *rsvp_UnkObjList; /* list of unknown objects */ /* * Variable-length list, with rsvp_nlist entries */ int rsvp_nlist; /* Count of entries in rsvp_list[] */ union { SenderDesc Sender_list; /* For Path-like messages */ FlowDesc Resv_list; /* For Resv-like messages */ } rsvp_list[1];} packet_map;#define Map_Length(n) (sizeof(packet_map) + (n-1)*sizeof(FlowDesc))/* * Structure for handling, parsing, and building an RSVP message. * * For sending, area of pkt_offset bytes is reserved at * beginning of buffer for building IP and/or UDP header. * */struct packet { common_header *pkt_data; /* -> RSVP msg in buffer */ int pkt_len; /* Size of packet/buffer */ packet_map *pkt_map; /* -> packet map */ u_short pkt_offset; /* pkt_data - start_of_buff */ u_char pkt_flags; /* Flags */#define PKTFLG_USE_UDP 0x01 /* Send as UDP-encap'd */#define PKTFLG_RAW_UDP 0x02 /* Send UDP-encap as raw packet */#define PKTFLG_SET_SRC 0x04 /* Build our own IP hdr with src */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -