1 /* 2 3 4 W3C Sample Code Library libwww User Profile Class 5 6 7 ! 8 The User Profile Class 9 ! 10 */ 11 12 /* 13 ** (c) COPYRIGHT MIT 1995. 14 ** Please first read the full copyright statement in the file COPYRIGH. 15 */ 16 17 /* 18 19 The User profile class manages what we know about a user on this 20 host. This can for example be the FQDN of the host, the user's email 21 address, the time zone, the news server etc. Note that this information does 22 not correspond to the actual information for the host but instead represents 23 "the information that the user wants to show the world". The user may use 24 an arbitrary email address to be used in a HTTP 25 request, for example. The application may assign a context to each use 26 which gives the application to extend the use of this class. 27 28 This module is implemented by HTUser.c, and it is 29 a part of the W3C Sample Code 30 Library. 31 */ 32 33 #ifndef HTUSER_H 34 #define HTUSER_H 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 typedef struct _HTUserProfile HTUserProfile; 41 42 /* 43 . 44 Creation and Deletion Methods 45 . 46 47 The application may create any number of user profile objects. By default 48 the Library creates a generic user which is the default value used to initialize 49 a Request object. This can be replaced by other 50 user profiles at any point in time. 51 ( 52 Create a User Profile 53 ) 54 */ 55 extern HTUserProfile * HTUserProfile_new (const char * name, void * context); 56 57 /* 58 ( 59 Localize a User Profile 60 ) 61 62 Localize a user profile by filling in all the information that we can figure 63 out automatically, for example the email address, news server etc. 64 */ 65 extern BOOL HTUserProfile_localize (HTUserProfile * up); 66 67 /* 68 ( 69 Delete a User Profile 70 ) 71 */ 72 extern BOOL HTUserProfile_delete (HTUserProfile * up); 73 74 /* 75 . 76 User Profile Class Methods 77 . 78 ( 79 Fully Qualified Domain Name (FQDN) 80 ) 81 82 The FQDN is a fully qualified domain name in that it contains both a local 83 host name and the domain name. It turns out that this is in fact very difficult 84 to obtain a FQDN on a variety of platforms. 85 */ 86 87 extern char * HTUserProfile_fqdn (HTUserProfile * up); 88 extern BOOL HTUserProfile_setFqdn (HTUserProfile * up, const char * fqdn); 89 90 /* 91 ( 92 User Email Address 93 ) 94 95 This is the email address that the user wants to send out for example as 96 a "password" when using anonymous FTP access and 97 as a "From" field in a HTTP request. 98 */ 99 100 extern char * HTUserProfile_email (HTUserProfile * up); 101 extern BOOL HTUserProfile_setEmail (HTUserProfile * up, const char * email); 102 103 /* 104 ( 105 News Server 106 ) 107 108 Control the news server that this user wishes to use 109 */ 110 111 extern char * HTUserProfile_news (HTUserProfile * host); 112 extern BOOL HTUserProfile_setNews (HTUserProfile * host, const char * news); 113 114 /* 115 ( 116 Location of Temporary Files 117 ) 118 119 Control the location for temporary files for this profile. The format 120 must be in URL format which is different from local file syntax as 121 URL syntaz always uses '/' as delimiters and also encoding of special 122 characters. See the 123 documentation on URLs 124 for more information about URL syntax. 125 */ 126 127 extern char * HTUserProfile_tmp (HTUserProfile * host); 128 extern BOOL HTUserProfile_setTmp (HTUserProfile * host, const char * tmp); 129 130 /* 131 ( 132 Local Time Zone (in seconds) 133 ) 134 135 Another widely used piece information that is very hard toobtain is the local 136 time zone. As we often must convert to and from GMT (Universal Time) we must 137 have the correct time zone. If we for some reason guesses wrong then the 138 user must change it manually. 139 */ 140 141 extern time_t HTUserProfile_timezone (HTUserProfile * up); 142 extern BOOL HTUserProfile_setTimezone (HTUserProfile * up, time_t timezone); 143 144 /* 145 ( 146 User Profile Context 147 ) 148 149 The applicatoin may have additional information that it wishes to assign 150 to a user profile. It can do this using the user context which is handled 151 as follows: 152 */ 153 154 extern void * HTUserProfile_context (HTUserProfile * up); 155 extern BOOL HTUserProfile_setContext (HTUserProfile * up, void * context); 156 157 /* 158 */ 159 160 #ifdef __cplusplus 161 } 162 #endif 163 164 #endif /* HTUser_H */ 165 166 /* 167 168 169 170 @(#) $Id$ 171 172 */ 173