📄 cslapp.h
字号:
/* PICS library utilities! PICS library utilities!*//*** (c) COPYRIGHT MIT 1996.** Please first read the full copyright statement in the file COPYRIGH.*//**/#ifndef CSLAPP_H#define CSLAPP_H#include "WWWCore.h"#include "CSLUtils.h"/*( CSApp_error)Return codes for those functions which do not return a pointer.*//*typedef enum { CSApp_OK, CSCSApp_done, CSApp_memory, CSApp_file, CSApp_badHandle, CSApp_inconsistentParms, CSApp_badPassword, CSApp_internal, CSApp_allowed, CSApp_denied} CSApp_error;*//*( CSDisposition_callback)- function to be called by the when Pics receives ratings for a requesteddocument. The callback is called afer the PICS library has decided whetherthe user should be permitted access to the document.CSDisposition_criteria - when to call the apppReq - HTRequest which told libwww to load the documentdisposition - CSApp_OK if user should see document, CSApp_denied otherwisepVoid - void pointer passed to CSApp_registerApp or CSApp_registerReq.*/typedef enum { CSApp_neverCall = 0, CSApp_callOnBad = 1, CSApp_callOnGood = 2} CSDisposition_criteria;typedef CSError_t (CSDisposition_callback)(HTRequest* pReq, CSLabel_t * pCSLabel, CSUser_t * pCSUser, CSError_t disposition, void * pVoid);/*CSApp.c maintains a list of LoadedUsers. More thanone may be loaded at a time as different requests may be associated withdifferent users.*/extern CSUser_t * CSLoadedUser_load(char * url, char * relatedName);extern BOOL CSLoadedUser_add(CSUser_t * pCSUser, char * url);extern BOOL CSLoadedUser_remove(CSUser_t * pCSUser);extern BOOL CSLoadedUser_find(char * name);extern BOOL CSLoadedUser_deleteAll (void);/*CSLoadedUser_enum - used to iterate through the loaded userspCallback - application callback to call with each userpVoid - passed through to callback*/typedef CSError_t (CSLoadedUserCallback)(CSUser_t * pCSUser, int index, void * pVoid);extern int CSLoadedUser_enum(CSLoadedUserCallback * pCallback, void * pVoid);/*. CSUserList.stores a list of PICS users and the URLs to their descritpion files( CSUserList_load)*/extern BOOL CSUserList_load(char * url, char * relatedName);/*( CSUserList_enum)used to iterate through the known userspCallback - application callback to call with each userpVoid - passed through to callbackusernameurl - where to find this user's profileindex*/typedef CSError_t (CSUserListCallback)(char * username, char * url, int index, void * pVoid);extern int CSUserList_enum(CSUserListCallback * pCallback, void * pVoid);/*! Registering Users!*/extern BOOL CSApp_registerDefaultUserByName(char * user, char * password);extern CSUser_t * CSApp_registerUserByName(char * user, char * password);extern BOOL CSApp_setDefaultUser(CSUser_t * pCSUser);extern BOOL CSApp_checkUser(CSUser_t * pCSUser);extern BOOL CSApp_unregisterDefaultUser(void);extern BOOL CSApp_unregisterUser(CSUser_t * pCSUser);/*! application functions!( CSApp_registerApp)- register defaults for an applicationpCallback - callback to tell app the disposition of header checkcriteria - when the app wants the callbackpUserCallback - called when a new user is loaded. It returns: o 1: load this user and set as default o 0: load this user o -1: get rid of it pVoid - passed through to callbackCSApp_unregisterApp - unregister defaults and free associated memory*/typedef int (CSApp_userCallback)(CSUser_t * pCSUser, void * pVoid);extern BOOL CSApp_registerApp(CSDisposition_callback * pCallback, CSDisposition_criteria criteria, CSApp_userCallback * pUserCallback, void * pVoid);extern BOOL CSApp_unregisterApp();/*( CSApp_registerReq)- override defaults for a particular request. It is advisable to use thisfunction, rather than relying on the defaults as it eliminates many problemsassociated with multiple clients using the same dynamic library. UseCSApp_UnregisterReq for every call to CSApp_RegisterReq.pReq - pointer to request about to be sent.rest - see parameters for CSApp_RegisterApp()CSApp_UnregisterReq - free memory associated with call to CSApp_registerReq*/extern BOOL CSApp_registerReq(HTRequest* pReq, CSUser_t * pCSUser, CSDisposition_callback callback, CSDisposition_criteria criteria, void * pVoid);extern BOOL CSApp_unregisterReq(HTRequest* pReq);extern HTRequest * CSApp_originalRequest(HTRequest* pReq);/*! MISC!CSApp_disposition - tell PICS if a request is allowd*/extern BOOL CSApp_label(HTRequest * pReq, CSLabel_t * pCSLabel);/*CSApp_libraryVersion - get current versionCSParseMachRead, CSParseUser, CSParseLabel - HTConverters for parsing tothese objectsCSLabel_output - spew canonical form of pCSLabel out to pStream*/char * CSApp_libraryVersion(void);extern HTConverter CSParseMachRead;extern HTConverter CSParseUser;extern HTConverter CSParseLabel;extern int CSLabel_output(CSLabel_t * pCSLabel, HTStream * pStream);/**/#endif /* CSLAPP_H *//*End of Declaration*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -