Ignore:
Timestamp:
Feb 12, 2015, 5:01:11 PM (9 years ago)
Author:
djay
Message:

Add initial doxygen comments in some C files, for future documentation generation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/ulinet.c

    r539 r579  
    1 /**
     1/*
    22 *  ulinet.c
    33 *
    44 * Author : Gérald FENOY
    55 *
    6  * Copyright (c) 2008-2010 GeoLabs SARL
     6 * Copyright (c) 2008-2015 GeoLabs SARL
    77 *
    88 * Permission is hereby granted, free of charge, to any person obtaining a copy
     
    3030#include "ulinet.h"
    3131#include <assert.h>
    32  
     32
     33/**
     34 * Write the downloaded content to a _HINTERNET structure
     35 *
     36 * @param buffer the buffer to read
     37 * @param size size of each member
     38 * @param nmemb number of element to read
     39 * @param data the _HINTERNET structure to write in
     40 * @return the size red, -1 if buffer is NULL
     41 */
    3342size_t write_data_into(void *buffer, size_t size, size_t nmemb, void *data){
    3443  size_t realsize = size * nmemb;
     
    5867}
    5968
     69/**
     70 * In case of presence of "Set-Cookie" in the headers red, store the cookie
     71 * identifier in CCookie
     72 *
     73 * @param buffer the buffer to read
     74 * @param size size of each member
     75 * @param nmemb number of element to read
     76 * @param data the _HINTERNET structure to write in
     77 * @return the size red, -1 if buffer is NULL
     78 * @see CCookie
     79 */
    6080size_t header_write_data(void *buffer, size_t size, size_t nmemb, void *data){
    6181  if(strncmp("Set-Cookie: ",(char*)buffer,12)==0){
     
    82102};
    83103
    84 
     104/**
     105 * Define the proxy to use for a CURL handler
     106 *
     107 * @param handle the CURL handler
     108 * @param host the proxy host (including http://)
     109 * @param port the proxy port
     110 */
    85111void setProxy(CURL* handle,char* host,long port){
     112  char* proxyDef=(char*)malloc((strlen(host)+10+2)*sizeof(char));
     113  sprintf(proxyDef,"%s:%ld",host,port);
     114  curl_easy_setopt(handle,CURLOPT_PROXY,proxyDef);
     115  free(proxyDef);
    86116}
    87117
     
    154184#else
    155185/**
    156  * Linux (Gnome)
     186 * Should autodetect the proxy configuration (do nothing on linux)
     187 *
     188 * @param handle a CURL handle
     189 * @param proto the protocol requiring the use of a proxy
    157190 */
    158191bool setProxiesForProtcol(CURL* handle,const char *proto){
     
    164197#endif
    165198
     199/**
     200 * Create a HINTERNET
     201 *
     202 * @param lpszAgent the HTPP User-Agent to use to send requests
     203 * @param  dwAccessType type of access required
     204 * @param  lpszProxyName the name of the proxy server(s) to use
     205 * @param  lpszProxyBypass ip address or host names which should not be routed
     206 *  through the proxy
     207 * @param  dwFlags Options (INTERNET_FLAG_ASYNC,INTERNET_FLAG_FROM_CACHE,INTERNET_FLAG_OFFLINE)
     208 * @return the created HINTERNET
     209 */
    166210HINTERNET InternetOpen(char* lpszAgent,int dwAccessType,char* lpszProxyName,char* lpszProxyBypass,int dwFlags){
    167211  HINTERNET ret;
     
    173217}
    174218
     219/**
     220 * Close a HINTERNET connection and free allocated ressources
     221 *
     222 * @param handle0 the HINTERNET connection to close
     223 */
    175224void InternetCloseHandle(HINTERNET* handle0){
    176225  int i=0;
     
    200249}
    201250
     251/**
     252 * Create a new element in the download queue
     253 *
     254 * @param hInternet the HINTERNET connection to add the download link
     255 * @param lpszUrl the url to download
     256 * @param lpszHeaders the additional headers to be sent to the HTTP server
     257 * @param dwHeadersLength the size of the additional headers
     258 * @param dwFlags desired download mode (INTERNET_FLAG_NO_CACHE_WRITE for not using cache file)
     259 * @param dwContext not used
     260 */
    202261HINTERNET InternetOpenUrl(HINTERNET* hInternet,LPCTSTR lpszUrl,LPCTSTR lpszHeaders,size_t dwHeadersLength,size_t dwFlags,size_t dwContext){
    203262
     
    289348};
    290349
     350/**
     351 * Download all opened urls in the queue
     352 *
     353 * @param hInternet the HINTERNET structure containing the queue
     354 * @return 0
     355 */
    291356int processDownloads(HINTERNET* hInternet){
    292357  int still_running=0;
     
    307372}
    308373
     374/**
     375 * Initialize the CCookie for a specific index (hInternet.nb)
     376 *
     377 * @param hInternet the HINTERNET structure to know the CCookie index to reset
     378 * @return 1
     379 * @see HINTERNET
     380 */
    309381int freeCookieList(HINTERNET hInternet){
    310382  memset(&CCookie[hInternet.nb][0],0,1024);
     
    315387}
    316388
     389/**
     390 * Copy a downloaded content
     391 *
     392 * @param hInternet the _HINTERNET structure
     393 * @param lpBuffer the memory space to copy the downloaded content
     394 * @param dwNumberOfBytesToRead the size of lpBuffer
     395 * @param lpdwNumberOfBytesRead number of bytes red
     396 * @return 1 on success, 0 if failure
     397 */
    317398int InternetReadFile(_HINTERNET hInternet,LPVOID lpBuffer,int dwNumberOfBytesToRead, size_t *lpdwNumberOfBytesRead){
    318399  int dwDataSize;
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png