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