Quality of Service Examples
Chapter
6
Examples of Custom SAFs
235
void decode(const char* val, PRInt32* var, pblock* pb)
{
char* pbval;
if ( (!var) || (!val) || (!pb) )
return;
pbval = pblock_findval(val, pb);
if (!pbval)
return;
*var = atoi(pbval);
}
/*-----------------------------------------------------------------------------
qos_error
This function is meant to be an error handler for an HTTP 503 error code,
which is returned by qos_handler when QOS limits are exceeded and enforced
This sample function just prints out a message about which limits were exceeded.
-----------------------------------------------------------------------------*/
NSAPI_PUBLIC int qos_error(pblock *pb, Session *sn, Request *rq)
{
char error[1024] = "";
PRBool ours = PR_FALSE;
PRInt32 vs_bw = 0, vs_bwlim = 0, vs_bw_ef = 0,
vs_conn = 0, vs_connlim = 0, vs_conn_ef = 0,
vsc_bw = 0, vsc_bwlim = 0, vsc_bw_ef = 0,
vsc_conn = 0, vsc_connlim = 0, vsc_conn_ef = 0,
srv_bw = 0, srv_bwlim = 0, srv_bw_ef = 0,
srv_conn = 0, srv_connlim = 0, srv_conn_ef = 0;
pblock* apb = rq->vars;
decode("vs_bandwidth", &vs_bw, apb);
decode("vs_connections", &vs_conn, apb);
decode("vs_bandwidth_limit", &vs_bwlim, apb);
decode("vs_bandwidth_enforced", &vs_bw_ef, apb);
decode("vs_connections_limit", &vs_connlim, apb);
decode("vs_connections_enforced", &vs_conn_ef, apb);
decode("vsclass_bandwidth", &vsc_bw, apb);
decode("vsclass_connections", &vsc_conn, apb);
decode("vsclass_bandwidth_limit", &vsc_bwlim, apb);
decode("vsclass_bandwidth_enforced", &vsc_bw_ef, apb);
decode("vsclass_connections_limit", &vsc_connlim, apb);
Summary of Contents for ENTERPRISE SERVER 6.1
Page 1: ...NSAPI Programmer s Guide Netscape Enterprise Server Version6 1 April 2002 Draft...
Page 290: ...Miscellaneous 290 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Page 318: ...cinfo 318 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Page 336: ...Buffered Streams 336 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Page 344: ...344 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Page 350: ...350 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...
Page 356: ...356 Netscape Enterprise Server NSAPI Programmer s Guide April 2002 Draft...