📄 rsvpapi.txt
字号:
the call returns an opaque but non-zero session handle for use in subsequent calls related to this API session. If the call fails synchronously, it returns zero (NULL_SID) and stores a RAPI error code into an integer variable pointed to by the "errnop" parameter. After a successful rapi_session call has been made, the application may receive upcalls of type RAPI_PATH_EVENT for the API session. unsigned int rapi_session( struct sockaddr *Dest, /* Session: (Dst addr, port) */ int Protid, /* Protocol Id */ int flags, /* flags */ int (*Event_rtn)(), /* Address of upcall routine */ void *Event_arg, /* App argument to upcall */ int *errnop /* Place to return error code*/ ) The parameters are as follows. o "Dest" This required parameter points to a sockaddr structure defining the destination IP (V4 or V6) address and a port number to which data will be sent. The "Dest" and "Protid" parameters define an RSVP session. If the "Protid" specifies UDP or TCP transport, the port corresponds to the appropriate transport port number. o "Protid" The IP protocol ID for the session. If it is omitted (i.e., zero), 17 (UDP) is assumed. o "flags"Braden, Hoffman Expiration: February 1999 [Page 7]Internet Draft RAPI v.5 August 1998 RAPI_GPI_SESSION (0x40) -- If set, this flag requests that this API session be defined in the GPI format used by the IPSEC extension of RSVP. If this flag is set, the port number included in "Dest" is considered "virtual" (see the IPSEC specification for details), and any sender template and filter specifications must be in GPI format. RAPI_USE_INTSERV (0X10) -- If set, IntServ formats are used in upcalls; otherwise, the Simplified format is used (see Section 4 below). o "Event_rtn" This parameter is a pointer to an upcall routine that will be invoked to notify the application of RSVP errors and state change events. This parameter is required. o "Event_arg" This optional parameter points to an argument that will be passed in any invocation of the upcall routine. o "errnop" The address of an integer into which a RAPI error code will be returned. An application can have multiple API sessions registered for the same or different RSVP sessions at the same time. There can be at most one sender associated with each API session; however, an application can announce multiple senders for a given RSVP session by announcing each sender in a separate API session. Two API sessions for the same RSVP session, if they are receiving data, are assumed to have joined the same multicast group and will receive the same data packets. At present, if two or more such sessions issue "rapi_reserve" calls, their reservation parameters must agree or the results will be undefined. There is no check for such a conflict. Furthermore, the code does not disallow multiple API sessions for the same sender (defined by the host interface and the local UDP port) within the same RSVP session, i.e., for the same data flow. If these API sessions are created by different application processes on the local host, the data packets they send will be merged but their sender declarations will not be. B. Specify Sender ParametersBraden, Hoffman Expiration: February 1999 [Page 8]Internet Draft RAPI v.5 August 1998 An application must issue a rapi_sender call if it intends to send a flow of data for which receivers may make reservations. This call defines, redefines, or deletes the parameters of that flow. A rapi_sender call may be issued more than once for the same API session; the most recent one takes precedence. If there is a synchronous error, rapi_sender() returns a RAPI error code; otherwise, it returns zero. Once a successful rapi_sender call has been made, the application may receive upcalls of type RAPI_RESV_EVENT or RAPI_PATH_ERROR. int rapi_sender( int Sid, /* Session ID */ int flags, /* Flags */ struct sockaddr *LHost, /* Local Host */ rapi_filter_t *SenderTemplate, /* Sender template */ rapi_tspec_t *SenderTspec, /* Sender Tspec */ rapi_adspec_t *SenderAdspec, /* Sender Adspec */ rapi_policy_t *SenderPolicy, /* Sender policy data */ int TTL; /* Multicast data TTL */ ) The parameters are as follows. o "Sid" This required parameter must be a session ID returned by a successful rapi_session call. o "flags" No flags are currently defined for this call. o "LHost" This optional parameter may point to a sockaddr structure specifying the IP source address and the UDP source port from which data will be sent, or it may be NULL. If the IP source address is INADDR_ANY, the API will use the default IP (V4 or V6) address of the local host. This is sufficient unless the host is multihomed. The port number may be zero if the protocol for the session does not have ports. A NULL "LHost" parameter indicates that the application wishes to withdraw its registration as a sender. In thisBraden, Hoffman Expiration: February 1999 [Page 9]Internet Draft RAPI v.5 August 1998 case, the following parameters will all be ignored. o "SenderTemplate" This optional parameter may be a pointer to a RAPI filter spec structure (see Section 4) specifying the format of data packets to be sent, or it may be NULL. If this parameter is omitted (NULL), a sender template will be created internally from the "Dest" and "LHost" parameters. If a "SenderTemplate" parameter is present, the "LHost" parameter will be ignored. This parameter is required in order to declare the sender template for a session using IPSEC, i.e., a session created with the RAP_GPI_SESSION flag set. o "SenderTspec" This required parameter is a pointer to a Tspec that defines the traffic that this sender will create. o "SenderAdspec" This optional parameter may point to a RAPI Adspec structure (see Section 4), or it may be NULL. o "SenderPolicy" This optional parameter may be a pointer to a sender policy data structure, or it may be NULL. o "TTL" This parameter specifies the IP TTL (Time-to-Live) value with which multicast data will be sent. It allows RSVP to send its control messages with the same TTL scope as the data packets.Braden, Hoffman Expiration: February 1999 [Page 10]Internet Draft RAPI v.5 August 1998 C. Make, Modify, or Delete a Reservation The rapi_reserve procedure is called to make, modify, or delete a resource reservation for a session. The call may be repeated with different parameters, allowing the application to modify or remove the reservation; the latest call will take precedence. Depending upon the parameters, each call may or may not result in new Admission Control calls, which could fail asynchronously. If there is a synchronous error in this call, rapi_reserve() returns a RAPI error code; otherwise, it returns zero. Once this call has been successful, the application may receive an upcall of type RAPI_RESV_ERROR or RAPI_RESV_CONFIRM. An admission control failure (e.g., refusal of the QoS request) will be reported asynchronously by an upcall of type RAPI_RESV_ERROR. A " No Path State" error code indicates that RSVP state from one or more of the senders specified in "filter_list" has not (yet) propagated all the way to the receiver; it may also indicate that one or more of the specified senders has closed its API and that its RSVP state has been deleted from the routers. int rapi_reserve( int Sid, /* Session ID */ int flags, struct sockaddr *RHost, /* Receive host addr*/ int StyleId, /* Style ID */ rapi_stylex_t *Style_Ext, /* Style extension */ rapi_policy_t *Rcvr_Policy, /* Receiver policy */ int FilterSpecNo, /* # of filter specs */ rapi_filter_t *FilterSpec_list, /* List of filt specs*/ int FlowspecNo, /* # of flowspecs */ rapi_flowspec_t *Flowspec_list /* List of flowspecs*/ ) The parameters are as follows: o "Sid" This required parameter must be a session ID returned by a successful rapi_session call. o "flags"Braden, Hoffman Expiration: February 1999 [Page 11]Internet Draft RAPI v.5 August 1998 Setting the RAPI_REQ_CONFIRM flag will request confirmation of the reservation, by means of a confirmation upcall (type RAPI_RESV_CONFIRM). o "RHost" This optional parameter may be used to define the interface address on which data will be received. It is useful for a multi-homed host. If it is omitted or the host address is INADDR_ANY, the default interface will be assumed. o "StyleId" This required parameter specifies the reservation style id (values defined below). o "Style_Ext" This optional parameter is a pointer to a style-dependent extension to the parameter list, if any. o "Rcvr_Policy" This optional parameter is a pointer to a policy data structure, or it is NULL. o "FilterSpec_list", "FilterSpecNo" The "FilterSpec_list" parameter is a pointer to an area containing a sequential vector of RAPI filter spec objects. The number of objexts in this vector is specified in "FilterSpecNo". If "FilterSpecNo" is zero, the "FilterSpec_list" parameter will be ignored. o "Flowspec_list", "FlowspecNo" The "Flowspec_list" parameter is a pointer to an area containing a sequential vector of RAPI flow spec objects. The number of objects in this vector is specified in "FlowspecNo". If "FlowspecNo" is zero, the "Flowspec_list" parameter will be ignored. If FlowspecNo is zero, the rapi_reserve call will remove the current reservation(s) for the specified session, and FilterSpec_list and Flowspec_list will be ignored. Otherwise, the parameters depend upon the style, as follows. o Wildcard Filter (WF)Braden, Hoffman Expiration: February 1999 [Page 12]Internet Draft RAPI v.5 August 1998 Use "StyleId" = RAPI_RSTYLE_WILDCARD. The "Flowspec_list" parameter may be empty (to delete the reservation) or else point to a single flowspec. The "FilterSpec_list" parameter may be empty or it may point to a single filter spec containing appropriate wildcard(s). o Fixed Filter (FF) Use "StyleId" = RAPI_RSTYLE_FIXED. "FilterSpecNo" must equal "FlowspecNo". Entries in "Flowspec_list" and "FilterSpec_list" parameters will correspond in pairs. o Shared Explicit (SE) Use "StyleId" = RAPI_RSTYLE_SE. The "Flowspec_list" parameter should point to a single flowspec. The " FilterSpec_list" parameter may point to a list of any length.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -