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

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.
2.2     ! eric        6: **     @(#) $Id: HTProfil.c,v 2.1 1996/07/16 02:27:05 frystyk Exp $
2.1       frystyk     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: {
2.2     ! eric       25:     if (!preemptive) HTEventTerminate();
2.1       frystyk    26:     if (HTLib_isInitialized()) {
                     27:        HTFormat_deleteAll();
                     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:     /* Register the default set of transport protocols */
                     44:     HTTransportInit();
                     45: 
                     46:     /* Register the default set of BEFORE and AFTER filters */
                     47:     HTNetInit();
                     48: 
                     49:     /* Set up the default set of Authentication schemes */
                     50:     HTAAInit();
                     51: 
                     52:     /* Get any proxy or gateway environment variables */
                     53:     HTProxy_getEnvVar();
                     54: 
                     55:     /* Register the default set of converters */
                     56:     HTConverterInit(converters);
                     57:     HTFormat_setConversion(converters);
                     58: 
                     59:     /* Register the default set of transfer encoders and decoders */
                     60:     HTEncoderInit(encodings);
                     61:     HTFormat_setTransferCoding(encodings);
                     62: 
                     63:     /* Register the default set of MIME header parsers */
                     64:     HTMIMEInit();
                     65: 
                     66:     /* Register the default set of file suffix bindings */
                     67:     HTFileInit();
                     68: 
                     69:     /* Register the default set of Icons for directory listings */
                     70:     HTIconInit(NULL);
                     71: 
                     72:     /* Register the default set of messages and dialog functions */
                     73:     HTAlertInit();
                     74:     HTAlert_setInteractive(YES);
                     75: }
                     76: 
                     77: PUBLIC void HTProfile_newClient (const char * AppName, const char * AppVersion)
2.2     ! eric       78: {
        !            79:   /* set up default event loop */
        !            80:     HTEventInit();
2.1       frystyk    81:     client_profile(AppName, AppVersion);
                     82: 
                     83:     /* Register the default set of application protocol modules */
                     84:     HTProtocolInit();
                     85: }
                     86: 
                     87: PUBLIC void HTProfile_newPreemptiveClient (const char * AppName,
                     88:                                           const char * AppVersion)
                     89: {
                     90:     client_profile(AppName, AppVersion);
                     91: 
                     92:     /* Register the default set of application protocol modules */
                     93:     HTProtocolPreemptiveInit();
                     94: 
                     95:     /* Remember that we are loading preemptively */
                     96:     preemptive = YES;
                     97: }
                     98: 
                     99: PRIVATE void robot_profile (const char * AppName, const char * AppVersion)
                    100: {
                    101:     /* If the Library is not already initialized then do it */
                    102:     if (!HTLib_isInitialized()) HTLibInit(AppName, AppVersion);
                    103: 
                    104:     if (!converters) converters = HTList_new();
                    105:     if (!encodings) encodings = HTList_new();
                    106: 
                    107:     /* Register the default set of transport protocols */
                    108:     HTTransportInit();
                    109: 
                    110:     /* Register the default set of application protocol modules */
                    111:     HTProtocolInit();
                    112: 
                    113:     /* Set max number of sockets we want open simultanously */ 
                    114:     HTNet_setMaxSocket(6);
                    115: 
                    116:     /* Register some default set of BEFORE and AFTER filters */
                    117:     HTNetCall_addBefore(HTRuleFilter, NULL, 0); 
                    118:     HTNetCall_addBefore(HTProxyFilter, NULL, 0); 
                    119:     HTNetCall_addAfter(HTLogFilter, NULL, HT_ALL); 
                    120:     HTNetCall_addAfter(HTInfoFilter, NULL, HT_ALL); 
                    121: 
                    122:     /* Get any proxy or gateway environment variables */
                    123:     HTProxy_getEnvVar();
                    124: 
                    125:     /* Register the default set of converters including the HTML parser */
                    126:     HTConverterInit(converters);
                    127:     HTFormat_setConversion(converters);
                    128: 
                    129:     /* Register the default set of transfer encoders and decoders */
                    130:     HTEncoderInit(encodings);
                    131:     HTFormat_setTransferCoding(encodings);
                    132: 
                    133:     /* Register the default set of MIME header parsers */
                    134:     HTMIMEInit();
                    135: 
                    136:     /* Register the default set of file suffix bindings */
                    137:     HTFileInit();
                    138: 
                    139:     /* Register the default set of Icons for directory listings */
                    140:     HTIconInit(NULL);
                    141: 
                    142:     /* Register some default messages and dialog functions */
                    143:     if (HTAlert_interactive()) {
                    144:        HTAlert_add(HTError_print, HT_A_MESSAGE);
                    145:        HTAlert_add(HTConfirm, HT_A_CONFIRM);
                    146:        HTAlert_add(HTPrompt, HT_A_PROMPT);
                    147:        HTAlert_add(HTPromptPassword, HT_A_SECRET);
                    148:        HTAlert_add(HTPromptUsernameAndPassword, HT_A_USER_PW);
                    149:     }
                    150:     HTAlert_setInteractive(YES);
                    151: }
                    152: 
                    153: PUBLIC void HTProfile_newRobot (const char * AppName, const char * AppVersion)
                    154: {    
2.2     ! eric      155:   /* set up default event loop */
        !           156:     HTEventInit();
2.1       frystyk   157:     robot_profile(AppName, AppVersion);
                    158: 
                    159:     /* Register the default set of application protocol modules */
                    160:     HTProtocolInit();
                    161: }
                    162: 
                    163: PUBLIC void HTProfile_newPreemptiveRobot (const char * AppName,
                    164:                                          const char * AppVersion)
                    165: {
                    166:     robot_profile(AppName, AppVersion);
                    167: 
                    168:     /* Register the default set of application protocol modules */
                    169:     HTProtocolPreemptiveInit();
                    170: 
                    171:     /* Remember that we are loading preemptively */
                    172:     preemptive = YES;
                    173: }
                    174: 
                    175: 
                    176: 
                    177: 
                    178: 
                    179: 
                    180: 

Webmaster