📄 rapi_lib.h
字号:
IS_adsbody_t ISa; /* Int-serv format adspec */ } adsbody_u;} rapi_adspec_t;#define adspecbody_qosx adsbody_u.adsx#define adspecbody_IS adsbody_u.ISa/************************************************************************** * * Filter Spec formats * **************************************************************************//* RAPI filter spec/sender template formats */typedef rapi_format rapi_filterform_t;typedef struct { struct sockaddr_in sender;} rapi_filter_base_t;typedef struct { struct in_addr sender; u_int32_t gpi;} rapi_filter_gpi_t;#ifdef USE_IPV6typedef struct { struct sockaddr_in6 sender;} rapi_filter_base6_t;typedef struct { struct in6_addr sender; u_int32_t gpi;} rapi_filter_gpi6_t;#endif /* USE_IPV6 *//* * Filter Spec descriptor */typedef struct { int len; /* length of filter, in bytes */ rapi_filterform_t form; /* format (rapi_filterform_t) */ union { rapi_filter_base_t base; rapi_filter_gpi_t gpi;#ifdef USE_IPV6 rapi_filter_base6_t base6; rapi_filter_gpi6_t gpi6;#endif /* USE_IPV6 */ } filt_u; /* variable length */} rapi_filter_t;#define rapi_filt4 filt_u.base.sender#define rapi_filtbase4_addr rapi_filt4.sin_addr#define rapi_filtbase4_port rapi_filt4.sin_port#define rapi_filtgpi4 filt_u.gpi#define rapi_filtgpi4_addr rapi_filtgpi4.sender#define rapi_filtgpi4_gpi rapi_filtgpi4.gpi#ifdef USE_IPV6#define rapi_filt6 filt_u.base6.sender#define rapi_filtbase6_addr rapi_filt6.sin6_addr#define rapi_filtbase6_port rapi_filt6.sin6_port#define rapi_filtgpi6 filt_u.gpi6#define rapi_filtgpi6_addr rapi_filtgpi6.sender#define rapi_filtgpi6_gpi rapi_filtgpi6.gpi#endif /* USE_IPV6 *//************************************************************************** * * Policy Data formats * **************************************************************************/typedef struct { char name[1];} rapi_policy_name_string_t;/* * Policy Formats */typedef enum { RAPI_POLICY_NAME_STRING = 513 } rapi_policy_form_t;typedef enum { RAPI_POLICYF_INTEGRITY=0x1, /* Integrity it mandatory for this object */ RAPI_POLICYF_GLOBAL =0x2, /* global policy objects (snd/recv) */ RAPI_POLICYF_RESP =0x4} rapi_policy_flags_t;typedef struct { int len; /* actual length in bytes */ rapi_policy_form_t form; /* policy data format */ rapi_policy_flags_t flags; union { rapi_policy_name_string_t name_string; } pol_u;} rapi_policy_t;/******************************************************************//******************************************************************//* * Reservation style ids */typedef enum { RAPI_RSTYLE_WILDCARD = 1, /* STYLE_ID_WF */ RAPI_RSTYLE_FIXED = 2, /* STYLE_ID_FF */ RAPI_RSTYLE_SE = 3 /* STYLE_ID_SE */} rapi_styleid_t;#define RAPI_RSTYLE_MAX 3/* * Reservation style extension *//* This structure is currently undefined; in the future, it will * allow passing style-specific parameters for possible new styles. */typedef void rapi_stylex_t; /* RAPI client handle */typedef unsigned int rapi_sid_t;#define NULL_SID 0 /* Error return from rapi_session */ /* RAPI User callback function */typedef enum { RAPI_PATH_EVENT = 1, RAPI_RESV_EVENT = 2, RAPI_PATH_ERROR = 3, RAPI_RESV_ERROR = 4, RAPI_RESV_CONFIRM = 5,/* Following are private to ISI implementation: */ RAPI_PATH_STATUS = 9, RAPI_RESV_STATUS = 10} rapi_eventinfo_t;typedef int ((*rapi_event_rtn_t) ( rapi_sid_t, /* Which sid generated event */ rapi_eventinfo_t, /* Event type */ int, /* Style ID */ int, /* Error code */ int, /* Error value */ struct sockaddr *, /* Error node address */ u_char, /* Error flags */#define RAPI_ERRF_InPlace 0x01 /* Left resv in place */#define RAPI_ERRF_NotGuilty 0x02 /* This rcvr not guilty */ int, /* Number of filter specs/sender*/ /* templates in list */ rapi_filter_t *, /* Filter spec/sender templ list*/ int, /* Number of flowspecs/Tspecs */ rapi_flowspec_t *, /* Flowspec/Tspec list */ int, /* Number of adspecs */ rapi_adspec_t *, /* Adspec list */ void * /* Client supplied arg */));/* * RAPI External Functions */rapi_sid_t rapi_session( struct sockaddr * dest, /* Dest host, port */ int protid, /* Protocol Id */ int flags, /* Session flags */#define RAPI_USE_INTSERV 0X10 /* Use Int-Serv fmt in upcalls */#define RAPI_GPI_SESSION 0x08 /* Use GPI session format */ rapi_event_rtn_t event_rtn, /* optional */ void * event_rtn_arg, int * errnop /* Place to store errno */);int rapi_sender( rapi_sid_t sid, int flags, struct sockaddr * host, /* Sender [host, ] port */ rapi_filter_t * sender_template, /* optional */ rapi_tspec_t * sender_tspec, rapi_adspec_t * sender_adspec, /* optional */ rapi_policy_t * sender_policy, /* optional */ int ttl /* Data TTL (optional) */);int rapi_reserve( rapi_sid_t sid, int flags,#define RAPI_REQ_CONFIRM 0x20 /* Request confirmation */ struct sockaddr * rhost, rapi_styleid_t styleid, rapi_stylex_t * style_extension, rapi_policy_t * rcvr_policy, /* optional */ int n_filter, rapi_filter_t * filter_spec_list, int n_flow, rapi_flowspec_t * flow_spec_list);int rapi_release(rapi_sid_t sid);int rapi_getfd(rapi_sid_t sid);int rapi_dispatch(void);int rapi_version();/* Formatting routines in rapi_fmt.c */void rapi_fmt_flowspec(rapi_flowspec_t *, char *, int);void rapi_fmt_tspec(rapi_tspec_t *, char *, int);void rapi_fmt_adspec(rapi_adspec_t *, char *, int);void rapi_fmt_filtspec(rapi_filter_t *, char *, int);/* * RAPI Error Codes */#define RAPI_ERR_OK 0 /* No error */#define RAPI_ERR_INVAL 1 /* Invalid parameter */#define RAPI_ERR_MAXSESS 2 /* Too many sessions */#define RAPI_ERR_BADSID 3 /* Sid out of legal range. */#define RAPI_ERR_N_FFS 4 /* Wrong n_filter/n_flow for style*/#define RAPI_ERR_BADSTYLE 5 /* Illegal reservation style */#define RAPI_ERR_SYSCALL 6 /* Some sort of syscall err; see errno*/#define RAPI_ERR_OVERFLOW 7 /* Parm list overflow */#define RAPI_ERR_MEMFULL 8 /* Not enough memory */#define RAPI_ERR_NORSVP 9 /* Daemon doesn't respond/exist.*/#define RAPI_ERR_OBJTYPE 10 /* Object type error */#define RAPI_ERR_OBJLEN 11 /* Object length error */#define RAPI_ERR_NOTSPEC 12 /* No sender tspec in rapi_sendr*/#define RAPI_ERR_INTSERV 13 /* Intserv format error */#define RAPI_ERR_GPI_CONFLICT 14 /* IPSEC: Conflicting C-type */#define RAPI_ERR_BADPROTO 15 /* IPSEC: Protocol not AH|ESP */#define RAPI_ERR_BADVDPORT 16 /* IPSEC: vDstPort is zero */#define RAPI_ERR_GPISESS 17 /* IPSEC: Other parm error *//* The following occur only asynchronously, as the error value when * error code = RSVP_Err_API_ERROR */#define RAPI_ERR_BADSEND 21 /* Sender addr not my interface */#define RAPI_ERR_BADRECV 22 /* Recv addr not my interface */#define RAPI_ERR_BADSPORT 23 /* Sport !=0 but Dport == 0 */#define RAPI_ERR_UNSUPPORTED 254#define RAPI_ERR_UNKNOWN 255#ifdef ISI_TEST/* rapi_status(): Trigger EVENT upcalls for all current state for * specified session ID. This is experimental. */intrapi_status( rapi_sid_t sid, int flags#define RAPI_STAT_PATH 0x80 /* Path state status */#define RAPI_STAT_RESV 0x40 /* Resv state status */);#endif /* ISI_TEST */#ifdef __cplusplus}#endif#endif /* __rapilib_h_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -