Annotation of libwww/Library/src/HTProfil.c, revision 2.1

2.1     ! frystyk     1: /*
        !             2: **     APPLICATION PROFILES INITALIZATION
        !             3: **
        !             4: **     (c) COPYRIGHT MIT 1995.
        !             5: **     Please first read the full copyright statement in the file COPYRIGH.
        !             6: **     @(#) $Id: HTInit.c,v 2.64 1996/07/08 19:10:46 frystyk Exp $
        !             7: **
        !             8: **     Defines a set of application profiles
        !             9: */
        !            10: 
        !            11: /* Library include files */
        !            12: #include "sysdep.h"
        !            13: #include "WWWUtil.h"
        !            14: #include "WWWCore.h"
        !            15: #include "HTProfil.h"                                   /* Implemented here */
        !            16: 
        !            17: PRIVATE HTList * converters = NULL;
        !            18: PRIVATE HTList * encodings = NULL;
        !            19: PRIVATE BOOL preemptive = NO;
        !            20: 
        !            21: /* ------------------------------------------------------------------------- */
        !            22: 
        !            23: PUBLIC void HTProfile_delete (void)
        !            24: {
        !            25:     if (HTLib_isInitialized()) {
        !            26:        HTFormat_deleteAll();
        !            27:        if (!preemptive) HTEventrgTerminate();
        !            28:        HTLibTerminate();
        !            29:     }
        !            30: }
        !            31: 
        !            32: PRIVATE void client_profile (const char * AppName, const char * AppVersion)
        !            33: {
        !            34:     /* If the Library is not already initialized then do it */
        !            35:     if (!HTLib_isInitialized()) HTLibInit(AppName, AppVersion);
        !            36: 
        !            37:     if (!converters) converters = HTList_new();
        !            38:     if (!encodings) encodings = HTList_new();
        !            39: 
        !            40:     /* Register the default set of transport protocols */
        !            41:     HTTransportInit();
        !            42: 
        !            43:     /* Set up the default event loop */
        !            44:     HTEventInit();
        !            45: 
        !            46:     /* Register the default set of transport protocols */
        !            47:     HTTransportInit();
        !            48: 
        !            49:     /* Register the default set of BEFORE and AFTER filters */
        !            50:     HTNetInit();
        !            51: 
        !            52:     /* Set up the default set of Authentication schemes */
        !            53:     HTAAInit();
        !            54: 
        !            55:     /* Get any proxy or gateway environment variables */
        !            56:     HTProxy_getEnvVar();
        !            57: 
        !            58:     /* Register the default set of converters */
        !            59:     HTConverterInit(converters);
        !            60:     HTFormat_setConversion(converters);
        !            61: 
        !            62:     /* Register the default set of transfer encoders and decoders */
        !            63:     HTEncoderInit(encodings);
        !            64:     HTFormat_setTransferCoding(encodings);
        !            65: 
        !            66:     /* Register the default set of MIME header parsers */
        !            67:     HTMIMEInit();
        !            68: 
        !            69:     /* Register the default set of file suffix bindings */
        !            70:     HTFileInit();
        !            71: 
        !            72:     /* Register the default set of Icons for directory listings */
        !            73:     HTIconInit(NULL);
        !            74: 
        !            75:     /* Register the default set of messages and dialog functions */
        !            76:     HTAlertInit();
        !            77:     HTAlert_setInteractive(YES);
        !            78: }
        !            79: 
        !            80: PUBLIC void HTProfile_newClient (const char * AppName, const char * AppVersion)
        !            81: {    
        !            82:     client_profile(AppName, AppVersion);
        !            83: 
        !            84:     /* Register the default set of application protocol modules */
        !            85:     HTProtocolInit();
        !            86: }
        !            87: 
        !            88: PUBLIC void HTProfile_newPreemptiveClient (const char * AppName,
        !            89:                                           const char * AppVersion)
        !            90: {
        !            91:     client_profile(AppName, AppVersion);
        !            92: 
        !            93:     /* Register the default set of application protocol modules */
        !            94:     HTProtocolPreemptiveInit();
        !            95: 
        !            96:     /* Remember that we are loading preemptively */
        !            97:     preemptive = YES;
        !            98: }
        !            99: 
        !           100: PRIVATE void robot_profile (const char * AppName, const char * AppVersion)
        !           101: {
        !           102:     /* If the Library is not already initialized then do it */
        !           103:     if (!HTLib_isInitialized()) HTLibInit(AppName, AppVersion);
        !           104: 
        !           105:     if (!converters) converters = HTList_new();
        !           106:     if (!encodings) encodings = HTList_new();
        !           107: 
        !           108:     /* Register the default set of transport protocols */
        !           109:     HTTransportInit();
        !           110: 
        !           111:     /* Set up the default event loop */
        !           112:     HTEventInit();
        !           113: 
        !           114:     /* Register the default set of transport protocols */
        !           115:     HTTransportInit();
        !           116: 
        !           117:     /* Register the default set of application protocol modules */
        !           118:     HTProtocolInit();
        !           119: 
        !           120:     /* Set max number of sockets we want open simultanously */ 
        !           121:     HTNet_setMaxSocket(6);
        !           122: 
        !           123:     /* Register some default set of BEFORE and AFTER filters */
        !           124:     HTNetCall_addBefore(HTRuleFilter, NULL, 0); 
        !           125:     HTNetCall_addBefore(HTProxyFilter, NULL, 0); 
        !           126:     HTNetCall_addAfter(HTLogFilter, NULL, HT_ALL); 
        !           127:     HTNetCall_addAfter(HTInfoFilter, NULL, HT_ALL); 
        !           128: 
        !           129:     /* Get any proxy or gateway environment variables */
        !           130:     HTProxy_getEnvVar();
        !           131: 
        !           132:     /* Register the default set of converters including the HTML parser */
        !           133:     HTConverterInit(converters);
        !           134:     HTFormat_setConversion(converters);
        !           135: 
        !           136:     /* Register the default set of transfer encoders and decoders */
        !           137:     HTEncoderInit(encodings);
        !           138:     HTFormat_setTransferCoding(encodings);
        !           139: 
        !           140:     /* Register the default set of MIME header parsers */
        !           141:     HTMIMEInit();
        !           142: 
        !           143:     /* Register the default set of file suffix bindings */
        !           144:     HTFileInit();
        !           145: 
        !           146:     /* Register the default set of Icons for directory listings */
        !           147:     HTIconInit(NULL);
        !           148: 
        !           149:     /* Register some default messages and dialog functions */
        !           150:     if (HTAlert_interactive()) {
        !           151:        HTAlert_add(HTError_print, HT_A_MESSAGE);
        !           152:        HTAlert_add(HTConfirm, HT_A_CONFIRM);
        !           153:        HTAlert_add(HTPrompt, HT_A_PROMPT);
        !           154:        HTAlert_add(HTPromptPassword, HT_A_SECRET);
        !           155:        HTAlert_add(HTPromptUsernameAndPassword, HT_A_USER_PW);
        !           156:     }
        !           157:     HTAlert_setInteractive(YES);
        !           158: }
        !           159: 
        !           160: PUBLIC void HTProfile_newRobot (const char * AppName, const char * AppVersion)
        !           161: {    
        !           162:     robot_profile(AppName, AppVersion);
        !           163: 
        !           164:     /* Register the default set of application protocol modules */
        !           165:     HTProtocolInit();
        !           166: }
        !           167: 
        !           168: PUBLIC void HTProfile_newPreemptiveRobot (const char * AppName,
        !           169:                                          const char * AppVersion)
        !           170: {
        !           171:     robot_profile(AppName, AppVersion);
        !           172: 
        !           173:     /* Register the default set of application protocol modules */
        !           174:     HTProtocolPreemptiveInit();
        !           175: 
        !           176:     /* Remember that we are loading preemptively */
        !           177:     preemptive = YES;
        !           178: }
        !           179: 
        !           180: 
        !           181: 
        !           182: 
        !           183: 
        !           184: 
        !           185: 

Webmaster