📄 rapi_lib.h
字号:
/* * @(#) $Id: rapi_lib.h,v 1.4 2000/12/27 21:59:38 veer Exp $ *//************************************************************************** * rapi_lib.h -- include file for RSVP API (RAPI) * * Definitions of RSVP API (RAPI) library calls. * Matches: draft-ietf-intserv-rsvp-use-01.txt * * Also includes rsvp_intserv.h, which contains formats of integrated * services data structures across application program interface. * **************************************************************************//**************************************************************************** RSVPD -- ReSerVation Protocol Daemon USC Information Sciences Institute Marina del Rey, California Current version by: Bob Braden, August 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 __rapilib_h__#define __rapilib_h__#include "rsvp_types.h"#include "rsvp_intserv.h"#include <sys/socket.h>#ifdef __cplusplusextern "C" {#endif#ifndef NET_IF_H#define NET_IF_H//#include <net/if.h>#endif/************************************************************************** ************************************************************************** ** ** RAPI (RSVP API) defns for flowspec, Tspec, Adspec begin here... ** ** ************************************************************************** **************************************************************************//* * Flowspec/Tspec Service types */enum qos_service_type { QOS_TSPEC = 0, /* Generic Tspec */ QOS_CNTR_LOAD = 1, /* Controlled-Load service */ QOS_GUARANTEED = 2 /* Guaranteed Service *//* Backwards compatibility */#define QOS_TSPECX QOS_TSPEC#define QOS_GUARANTEEDX QOS_GUARANTEED};typedef struct { float32_t spec_Tspec_b; /* Token bucket depth (B) */ float32_t spec_Tspec_r; /* Token bucket avg rate (Bps)*/ float32_t spec_Tspec_p; /* Peak data rate (Bps) */ u_int32_t spec_Tspec_m; /* Min policed unit (B) */ u_int32_t spec_Tspec_M; /* Max pkt size (B) */} qos_Tspec_body; /* * Simplified-format Flowspec * * This structure contains the union of the parameters for * Controlled-Load and Guaranteed service models. */typedef struct { u_int32_t spec_type; /* qos_service_type */ qos_Tspec_body xspec_Tspec; /* Tspec */ float32_t xspec_R; /* Rate (Bps) */ u_int32_t xspec_S; /* Slack term (microsecs)*/} qos_flowspecx_t;#define xspec_r xspec_Tspec.spec_Tspec_r#define xspec_b xspec_Tspec.spec_Tspec_b#define xspec_p xspec_Tspec.spec_Tspec_p#define xspec_m xspec_Tspec.spec_Tspec_m#define xspec_M xspec_Tspec.spec_Tspec_M /* * Simplified-format Tspec. * * This structure contains the generic Tspec parameters. */typedef struct { u_int32_t spec_type; /* qos_service_type */ qos_Tspec_body xtspec_Tspec; /* Tspec */} qos_tspecx_t;#define xtspec_r xtspec_Tspec.spec_Tspec_r#define xtspec_b xtspec_Tspec.spec_Tspec_b#define xtspec_p xtspec_Tspec.spec_Tspec_p#define xtspec_m xtspec_Tspec.spec_Tspec_m#define xtspec_M xtspec_Tspec.spec_Tspec_M /* * Simplified-format Adspec. * * This structure is the union of all adspec parameters for * Controlled-Load and Guaranteed service models. */#define XASPEC_FLG_BRK 0x01 /* Break bit: serv. unsupported in some node */#define XASPEC_FLG_IGN 0x02 /* Ignore flag: Do not include this service */#define XASPEC_FLG_PARM 0x04 /* Parms-present flag: Include service parms */ /* (IGN and PARM flags both on is an error) */typedef struct { /* * General path characterization parameters */ u_char xaspec_flags; /* See flags above (FLG_IGN not */ /* allowed, FLG_PARM assumed) */ u_int16_t xaspec_hopcnt; float32_t xaspec_path_bw; u_int32_t xaspec_min_latency; u_int32_t xaspec_composed_MTU; /* Controlled-Load service Adspec parameters */ u_char xClaspec_flags; /* See flags above */ u_char xClaspec_override; /* 1 => override all gen */ /* parameters */ u_int16_t xClaspec_hopcnt; float32_t xClaspec_path_bw; u_int32_t xClaspec_min_latency; u_int32_t xClaspec_composed_MTU; /* Guaranteed service Adspec parameters */ u_char xGaspec_flags; /* See flags above */ u_int32_t xGaspec_Ctot; u_int32_t xGaspec_Dtot; u_int32_t xGaspec_Csum; u_int32_t xGaspec_Dsum; u_char xGaspec_override; /* 1 => override all gen */ /* parameters */ u_int16_t xGaspec_hopcnt; float32_t xGaspec_path_bw; u_int32_t xGaspec_min_latency; u_int32_t xGaspec_composed_MTU;} qos_adspecx_t;/************************************************************************** * * RAPI call formats and definitions * **************************************************************************/#define RAPI_VERSION 502 /* RAPI Version 5.02 */#define MAX_RAPI_SESS 100 /* max #flows the daemon api can handle *//* * Generic RAPI object header */typedef struct { int len; /* Actual length in bytes */ int form; /* Format (see rapi_format) */ /* Followed by type-specific contents */} rapi_hdr_t;#define RAPIObj_Size(p) (((rapi_hdr_t *)(p))->len)#define RAPIObj_data(p) ((rapi_hdr_t *)(p)+1)#define After_RAPIObj(p) ((char *)(p) + RAPIObj_Size(p))#define NTOH_RAPIhdr(p) {NTOH32(((rapi_hdr_t *)p)->len); \ NTOH32(((rapi_hdr_t *)p)->form);}#define HTON_RAPIhdr(p) {HTON32(((rapi_hdr_t *)p)->len); \ HTON32(((rapi_hdr_t *)p)->form);}/* Define RAPI flowspec/Tspec formats */typedef enum { RAPI_EMPTY_OTYPE = 0, /* Format = 0 => empty object */#ifdef OBSOLETE_API RAPI_FLOWSTYPE_CSZ = 1, /* qos: Legacy format */#endif /* OBSOLETE_RAPI */ RAPI_FLOWSTYPE_Intserv = 2, /* Int-Serv format flowspec */ RAPI_FLOWSTYPE_Simplified = 3, /* Simplified format flowspec */ RAPI_TSPECTYPE_Intserv = 17, /* Int-Serv format (sndr)Tspec */ RAPI_TSPECTYPE_Simplified = 18, /* Simplified format (sndr)Tspec*/ RAPI_ADSTYPE_Intserv = 33, /* Int-Serv format Adspec */ RAPI_ADSTYPE_Simplified =34, /* SImplified format Adspec */ RAPI_FILTERFORM_RSVD1 = 257, /* (obsolete format: reserved) */ RAPI_FILTERFORM_BASE = 258, /* Simple V4: Only sockaddr */ RAPI_FILTERFORM_GPI = 259, /* V4 GPI filter format */ RAPI_FILTERFORM_BASE6 = 260, /* Simple V6: Only sockaddr */ RAPI_FILTERFORM_GPI6 = 261, /* V6 GPI filter format */ RAPI_FILTERFORM_FL6 = 262 /* ??? -- ??? IPV6 stuff */} rapi_format;/* * RAPI Flowspec descriptor */typedef struct { int len; /* actual length in bytes */ int form; /* flowspec format (see enum above) */ union { qos_flowspecx_t qosx; /* Simplified format flowspec */ IS_specbody_t IS; /* Int-serv format flowspec */ } specbody_u;} rapi_flowspec_t;#define specbody_qosx specbody_u.qosx#define specbody_IS specbody_u.IS/* * RAPI Tspec descriptor */typedef struct { int len; /* actual length in bytes */ int form; /* flowspec format (see enum above) */ union { qos_tspecx_t qosxt; /* Simplified format Tspec */ IS_tspbody_t ISt; /* Int-serv format Tspec */ } tspecbody_u;} rapi_tspec_t;#define tspecbody_qosx tspecbody_u.qosxt#define tspecbody_IS tspecbody_u.ISt /* * RAPI Adspec descriptor */typedef struct { int len; /* actual length in bytes */ int form; /* adspec format(see rapi_format)*/ union { qos_adspecx_t adsx; /* Simplified format adspec */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -