Compounds | |||
![]() | ![]() | struct | clientGlobalStruct |
Functions | |||
![]() | ![]() | void | w3ClientInit () |
![]() | ![]() | boolean | w3ClientConnect (w3ClientConnection *con) |
![]() | ![]() | boolean | w3ClientGetDocument (w3Document *doc) |
![]() | ![]() | boolean | w3ClientDisconnect (w3ClientConnection *con) |
![]() | ![]() | boolean | w3ClientGetImagePath (char *uriString, boolean withoutHostname) |
![]() | ![]() | boolean | w3ClientDocToFile (const char* uriString, const char *filename, int port) |
![]() | ![]() | boolean | w3ClientDocToFileMT (const char* uriString, const char *filename, int port) |
![]() | ![]() | boolean | w3ClientJoinAllThreads () |
![]() | ![]() | boolean | w3ClientDestroyAllThreads () |
void w3ClientInit () |
Initialization of global data structures. Call this before doing anything with the client functions !
boolean w3ClientConnect (w3ClientConnection * con) |
Sets up a connection to con
. The following members of con
have to be set correctly:
hostname
port
boolean w3ClientGetDocument (w3Document * doc) |
Gets a document described by doc
. All fields in doc
except data
and dataLength
have to be set correctly. The latter two are filled by this function, data
contains the received data of length dataLength
.
true
if successful, otherwise false
. boolean w3ClientDisconnect (w3ClientConnection * con) |
Closes the connection con
.
true
if successful, otherwise false
. boolean w3ClientGetImagePath (char * uriString, boolean withoutHostname) |
boolean w3ClientDocToFile (const char * uriString, const char * filename, int port) |
Retrieves the URI described in uriString to file filename. Also retrieves all images using the lexical analyzer for images (img.lex). The html file is stored in filenamey
and in the cache directory defined by W3_CLIENT_CACHE_DIR
. Downloaded html files are stored flatly in the cache by using the whole URI and substituting slashes by underscores ("/" --> "_"). So,
www.goschs.de/hund/katze/maus.html would be cache/www.goschs.de_hund_katze_maus.html
All images are stored in subdirectories, starting with the hostname. E.g.,
www.goschs.de/www/images/hund.gif would be
cache/www.goschs.de/www/images/hund.gif
boolean w3ClientDocToFileMT (const char * uriString, const char * filename, int port) |
This is not supporting the cache structure yet. It is not maintained since it is not yet needed for the assignment in CNS. Opens a thread and returns immediately, without joining the thread. Use w3ClientJoin- od DestroyAllThreads () to join them. Be sure to always call one of the latter two to free the memory used by the thread structures, as soon as you have no more threads pending.
boolean w3ClientJoinAllThreads () |
Joins all pending threads and frees the taken memory.
boolean w3ClientDestroyAllThreads () |
Kills all pending threads and frees the taken memory.