Index: /trunk/zoo-project/zoo-kernel/otbZooWatcher.h
===================================================================
--- /trunk/zoo-project/zoo-kernel/otbZooWatcher.h	(revision 578)
+++ /trunk/zoo-project/zoo-kernel/otbZooWatcher.h	(revision 579)
@@ -21,13 +21,24 @@
 #include "service.h"
 
+/**
+ * Observer used to access the ongoing status of a running OTB Application
+ */
 class /*ITK_EXPORT*/ ZooWatcher : public otb::FilterWatcherBase
 {
 public:
 
-  /** Constructor. Takes a ProcessObject to monitor and an optional
-   * comment string that is prepended to each event message. */
+  /**
+   * Constructor
+   * @param process the itk::ProcessObject to monitor
+   * @param comment comment string that is prepended to each event message
+   */
   ZooWatcher(itk::ProcessObject* process,
                         const char *comment = "");
 
+  /**
+   * Constructor
+   * @param process the itk::ProcessObject to monitor
+   * @param comment comment string that is prepended to each event message
+   */
   ZooWatcher(itk::ProcessObject* process,
                         const std::string& comment = "");
@@ -36,13 +47,24 @@
   ZooWatcher();
 
-  /** Get/Set/Free Configuration maps */
+  /** 
+   * Copy the original conf in the m_Conf property
+   *
+   * @param conf the maps pointer to copy
+   */
   void SetConf(maps **conf)
   {
     m_Conf=dupMaps(conf);
   }
+  /**  
+   * Get Configuration maps (m_Conf)
+   * @return the m_Conf property
+   */
   const maps& GetConf() const
   {
     return *m_Conf;
   }
+  /**  
+   * Free Configuration maps (m_Conf)
+   */
   void FreeConf(){
     freeMaps(&m_Conf);
Index: /trunk/zoo-project/zoo-kernel/service.h
===================================================================
--- /trunk/zoo-project/zoo-kernel/service.h	(revision 578)
+++ /trunk/zoo-project/zoo-kernel/service.h	(revision 579)
@@ -1,3 +1,3 @@
-/**
+/*
  * Author : Gérald FENOY
  *
@@ -60,10 +60,31 @@
 }
 #else
+/**
+ * The crossplatform strdup alias
+ */
 #define zStrdup strdup
+/**
+ * The crossplatform mkdir alias
+ */
 #define zMkdir mkdir
+/**
+ * The crossplatform open alias
+ */
 #define zOpen open
+/**
+ * The crossplatform write alias
+ */
 #define zWrite write
+/**
+ * The crossplatform sleep alias
+ */
 #define zSleep sleep
+/**
+ * The crossplatform gettimeofday alias
+ */
 #define zGettimeofday gettimeofday
+/**
+ * The crossplatform timeval alias
+ */
 #define ztimeval timeval
 #endif 
@@ -87,19 +108,55 @@
 #endif
 #ifndef true
+  /**
+   * Local true definition
+   */
 #define true 1
+  /**
+   * Local false definition
+   */
 #define false -1
 #endif
 #endif
 
+/**
+ * The global accepted status for a service
+ */
 #define SERVICE_ACCEPTED 0
+/**
+ * The global started status for a service
+ */
 #define SERVICE_STARTED 1
+/**
+ * The global paused status for a service
+ */
 #define SERVICE_PAUSED 2
+/**
+ * The global succeeded status for a service
+ */
 #define SERVICE_SUCCEEDED 3
+/**
+ * The global failed status for a service
+ */
 #define SERVICE_FAILED 4
 
+/**
+ * The memory size to create an elements
+ */
 #define ELEMENTS_SIZE (sizeof(char*)+(((2*sizeof(char*))+sizeof(maps*))*2)+sizeof(char*)+(((2*sizeof(char*))+sizeof(iotype*))*2)+sizeof(elements*))
+/**
+ * The memory size to create a map
+ */
 #define MAP_SIZE (2*sizeof(char*))+sizeof(NULL)
+/**
+ * The memory size to create an iotype
+ */
 #define IOTYPE_SIZE MAP_SIZE+sizeof(NULL)
+/**
+ * The memory size to create a maps
+ */
 #define MAPS_SIZE (2*sizeof(char*))+sizeof(map*)+MAP_SIZE
+/**
+ * The memory size to create a service
+ */
 #define SERVICE_SIZE (ELEMENTS_SIZE*2)+(MAP_SIZE*2)+sizeof(char*)
 
@@ -116,6 +173,5 @@
 
   /**
-   * \struct map
-   * \brief KVP linked list
+   * KVP linked list
    *
    * Deal with WPS KVP (name,value).
@@ -138,6 +194,5 @@
 
   /**
-   * \struct maps
-   * \brief linked list of map pointer
+   * linked list of map pointer
    *
    * Small object to store WPS KVP set.
@@ -154,5 +209,7 @@
 
   /**
-   * \brief Dump a map on stderr
+   * Dump a map on stderr
+   *
+   * @param t the map to dump
    */
   static void _dumpMap(map* t){
@@ -166,4 +223,9 @@
   }
 
+  /**
+   * Dump a map on stderr, see _dumpMap()
+   *
+   * @param t the map to dump
+   */
   static void dumpMap(map* t){
     map* tmp=t;
@@ -174,4 +236,10 @@
   }
 
+  /**
+   * Dump a map to a file
+   *
+   * @param t the map to dump to file
+   * @param file the file to store the map
+   */
   static void dumpMapToFile(map* t,FILE* file){
     map* tmp=t;
@@ -185,4 +253,9 @@
   }
 
+  /**
+   * Dump a maps on stderr, see dumpMap().
+   *
+   * @param m the map to dump
+   */
   static void dumpMaps(maps* m){
     maps* tmp=m;
@@ -194,4 +267,10 @@
   }
 
+  /**
+   * Dump a maps to a file, see dumpMapToFile().
+   *
+   * @param m the map to dump
+   * @param file_path the full path to the file name to store the map
+   */
   static void dumpMapsToFile(maps* m,char* file_path){
     FILE* file=fopen(file_path,"w");
@@ -205,4 +284,11 @@
   }
 
+  /**
+   * Create a new map
+   *
+   * @param name the key to add to the map
+   * @param value the corresponding value to add to the map
+   * @return the allocated map
+   */
   static map* createMap(const char* name,const char* value){
     map* tmp=(map *)malloc(MAP_SIZE);
@@ -213,4 +299,10 @@
   }
 
+  /**
+   * Count number of map in a map
+   *
+   * @param m the maps to count
+   * @return number of map in a map
+   */
   static int count(map* m){
     map* tmp=m;
@@ -223,4 +315,11 @@
   }
     
+  /**
+   * Verify if a key exist in a map
+   *
+   * @param m the map to search for the key
+   * @param key the key to search in the map
+   * @return true if the key wwas found, false in other case
+   */
   static bool hasKey(map* m,const char *key){
     map* tmp=m;
@@ -236,4 +335,11 @@
   }
 
+  /**
+   * Access a specific maps
+   *
+   * @param m the maps to search for the key
+   * @param key the key to search in the maps
+   * @return a pointer on the maps found or NULL if not found
+   */
   static maps* getMaps(maps* m,const char *key){
     maps* tmp=m;
@@ -247,4 +353,11 @@
   }
 
+  /**
+   * Access a specific map
+   *
+   * @param m the map to search for the key
+   * @param key the key to search in the map
+   * @return a pointer on the map found or NULL if not found
+   */
   static map* getMap(map* m,const char *key){
     map* tmp=m;
@@ -259,4 +372,10 @@
 
 
+  /**
+   * Access the last map
+   *
+   * @param m the map to search for the lastest map
+   * @return a pointer on the lastest map found or NULL if not found
+   */
   static map* getLastMap(map* m){
     map* tmp=m;
@@ -270,4 +389,12 @@
   }
 
+  /**
+   * Access a specific map from a maps
+   *
+   * @param m the maps to search for the key
+   * @param key the key to search in the maps
+   * @param subkey the key to search in the map (found for the key, if any)
+   * @return a pointer on the map found or NULL if not found
+   */
   static map* getMapFromMaps(maps* m,const char* key,const char* subkey){
     maps* _tmpm=getMaps(m,key);
@@ -279,5 +406,10 @@
   }
 
-
+  /**
+   * Free allocated memory of a map.
+   * Require to call free on mo after calling this function.
+   *
+   * @param mo the map to free
+   */
   static void freeMap(map** mo){
     map* _cursor=*mo;
@@ -295,4 +427,10 @@
   }
 
+  /**
+   * Free allocated memory of a maps.
+   * Require to call free on mo after calling this function.
+   *
+   * @param mo the maps to free
+   */
   static void freeMaps(maps** mo){
     maps* _cursor=*mo;
@@ -314,5 +452,5 @@
 
   /**
-   * \brief Not named linked list
+   * Not named linked list
    *
    * Used to store informations about formats, such as mimeType, encoding ... 
@@ -328,9 +466,9 @@
 
   /**
-   * \brief Metadata information about input or output.
+   * Metadata information about input or output.
    *
    * The elements are used to store metadata informations defined in the ZCFG.
    *
-   * An elements is defined as :
+   * An elements is defined as:
    *  - a name,
    *  - a content map,
@@ -351,4 +489,14 @@
   } elements;
 
+  /**
+   * Metadata informations about a full Service.
+   *
+   * An element is defined as:
+   *  - a name,
+   *  - a content map,
+   *  - a metadata map,
+   *  - an inputs elements
+   *  - an outputs elements
+   */
   typedef struct service{
     char* name;
@@ -359,4 +507,7 @@
   } service;
 
+  /**
+   * Multiple services chained list.
+   */
   typedef struct services{
     struct service* content; 
@@ -364,4 +515,11 @@
   } services;
 
+  /**
+   * Verify if an elements contains a name equal to the given key.
+   *
+   * @param e the elements to search for the key
+   * @param key the elements name to search
+   * @return true if the elements contains the name, false in other cases.
+   */ 
   static bool hasElement(elements* e,const char* key){
     elements* tmp=e;
@@ -374,4 +532,11 @@
   }
 
+  /**
+   * Access a specific elements named key.
+   *
+   * @param m the elements to search
+   * @param key the elements name to search
+   * @return a pointer to the specific element if found, NULL in other case.
+   */ 
   static elements* getElements(elements* m,char *key){
     elements* tmp=m;
@@ -384,5 +549,10 @@
   }
 
-
+  /**
+   * Free allocated memory of an iotype.
+   * Require to call free on i after calling this function.
+   *
+   * @param i the iotype to free
+   */
   static void freeIOType(iotype** i){
     iotype* _cursor=*i;
@@ -397,4 +567,10 @@
   }
 
+  /**
+   * Free allocated memory of an elements.
+   * Require to call free on e after calling this function.
+   *
+   * @param e the iotype to free
+   */
   static void freeElements(elements** e){
     elements* tmp=*e;
@@ -423,4 +599,10 @@
   }
 
+  /**
+   * Free allocated memory of a service.
+   * Require to call free on e after calling this function.
+   *
+   * @param s the service to free
+   */
   static void freeService(service** s){
     service* tmp=*s;
@@ -443,4 +625,11 @@
   }
 
+  /**
+   * Add key value pair to an existing map.
+   *
+   * @param m the map to add the KVP
+   * @param n the key to add
+   * @param v the corresponding value to add
+   */
   static void addToMap(map* m,const char* n,const char* v){
     if(hasKey(m,n)==false){
@@ -459,4 +648,12 @@
   }
 
+  /**
+   * Add a key and a binary value to an existing map.
+   *
+   * @param m the map to add the KVP
+   * @param n the key to add
+   * @param v the corresponding value to add
+   * @param size the size of the given value
+   */
   static void addToMapWithSize(map* m,const char* n,const char* v,int size){
     if(hasKey(m,n)==false){
@@ -479,4 +676,10 @@
   }
 
+  /**
+   * Add a map at the end of another map.
+   *
+   * @param mo the map to add mi
+   * @param mi the map to add to mo
+   */
   static void addMapToMap(map** mo,map* mi){
     map* tmp=mi;
@@ -511,4 +714,10 @@
   }
 
+  /**
+   * Add a map to iotype.
+   *
+   * @param io the iotype to add the map
+   * @param mi the map to add to io
+   */
   static void addMapToIoType(iotype** io,map* mi){
     iotype* tmp=*io;
@@ -522,4 +731,12 @@
   }
 
+  /**
+   * Access a specific map or set its value.
+   *
+   * @param m the map to search for the key
+   * @param key the key to search/add in the map
+   * @param value the value to add if the key does not exist
+   * @return a pointer on the map found or NULL if not found
+   */
   static map* getMapOrFill(map** m,const char *key,const char* value){
     map* tmp=*m;
@@ -536,4 +753,11 @@
   }
 
+  /**
+   * Verify if a map is contained in another map.
+   *
+   * @param m the map to search for i
+   * @param i the map to search in m
+   * @return true if i was found in m, false in other case
+   */
   static bool contains(map* m,map* i){
     while(i!=NULL){      
@@ -552,4 +776,13 @@
   }
 
+  /**
+   * Access a specific iotype from an elements.
+   *
+   * @param e the elements to search for the name
+   * @param name the name to search in the elements e
+   * @param values the map to verify it was contained in the defaults or 
+   *  supported content of the elements e
+   * @return a pointer on the iotype found or NULL if not found
+   */
   static iotype* getIoTypeFromElement(elements* e,char *name, map* values){
     elements* cursor=e;
@@ -572,4 +805,11 @@
   }
 
+  /**
+   * Load binary values from a map (in) and add them to another map (out)
+   *
+   * @param out the map to add binaries values
+   * @param in the map containing the binary values to add ti out
+   * @param pos index of the binary in an array (in case of "MapArray")
+   */
   static void loadMapBinary(map** out,map* in,int pos){
     map* size=getMap(in,"size");
@@ -598,4 +838,12 @@
   }
   
+  /**
+   * Load binary values from a map (in) and add them to another map (out).
+   * This function will take care of MapArray.
+   * @see loadMapBinary
+   *
+   * @param out the map to add binaries values
+   * @param in the map containing the binary values to add ti out
+   */
   static void loadMapBinaries(map** out,map* in){
     map* size=getMap(in,"size");
@@ -613,4 +861,10 @@
   }
 
+  /**
+   * Duplicate a Maps
+   * 
+   * @param mo the maps to clone
+   * @return the allocated maps containing a copy of the mo maps
+   */
   static maps* dupMaps(maps** mo){
     maps* _cursor=*mo;
@@ -631,4 +885,11 @@
   }
 
+  /**
+   * Add a maps at the end of another maps.
+   *
+   * @see addMapToMap, dupMaps, getMaps
+   * @param mo the maps to add mi
+   * @param mi the maps to add to mo
+   */
   static void addMapsToMaps(maps** mo,maps* mi){
     maps* tmp=mi;
@@ -652,4 +913,12 @@
   }
 
+  /**
+   * Access a specific map array element
+   *
+   * @param m the map to search for the key
+   * @param key the key to search in the map
+   * @param index of the MapArray 
+   * @return a pointer on the map found or NULL if not found
+   */
   static map* getMapArray(map* m,const char* key,int index){
     char tmp[1024];
@@ -670,4 +939,13 @@
 
 
+  /**
+   * Add a key value in a MapArray for a specific index
+   *
+   * @param m the map to search for the key
+   * @param key the key to search in the map
+   * @param index the index of the MapArray 
+   * @param value the value to set in the MapArray 
+   * @return a pointer on the map found or NULL if not found
+   */
   static void setMapArray(map* m,const char* key,int index,const char* value){
     char tmp[1024];
@@ -697,4 +975,11 @@
   }
 
+  /**
+   * Access the map "type"
+   *
+   * @param mt the map
+   * @return a pointer on the map for mimeType/dataType/CRS if found, NULL in
+   *  other case
+   */
   static map* getMapType(map* mt){
     map* tmap=getMap(mt,(char *)"mimeType");
@@ -711,4 +996,13 @@
   }
 
+  /**
+   * Add a Maps containing a MapArray to a Maps
+   *
+   * @see getMapType
+   * @param mo the maps
+   * @param mi the maps
+   * @param typ the map "type"
+   * @return 
+   */
   static int addMapsArrayToMaps(maps** mo,maps* mi,char* typ){
     maps* tmp=mi;    
@@ -759,4 +1053,12 @@
   }
 
+  /**
+   * Set a key value pair to a map contained in a Maps
+   *
+   * @param m the maps
+   * @param key the maps name
+   * @param subkey the map name included in the maps corresponding to key
+   * @param value the corresponding value to add in the map
+   */
   static void setMapInMaps(maps* m,const char* key,const char* subkey,const char *value){
     maps* _tmpm=getMaps(m,key);
@@ -787,5 +1089,9 @@
   }
 
-
+  /**
+   * Dump an elements on stderr
+   *
+   * @param e the elements to dump
+   */
   static void dumpElements(elements* e){
     elements* tmp=e;
@@ -818,4 +1124,9 @@
   }
 
+  /**
+   * Dump an elements on stderr using the YAML syntaxe
+   *
+   * @param e the elements to dump
+   */
   static void dumpElementsAsYAML(elements* e){
     elements* tmp=e;
@@ -889,5 +1200,10 @@
   }
 
-
+  /**
+   * Duplicate an elements
+   * 
+   * @param e the elements to clone
+   * @return the allocated elements containing a copy of the elements e
+   */
   static elements* dupElements(elements* e){
     elements* cursor=e;
@@ -939,4 +1255,11 @@
   }
 
+  /**
+   * Add an elements to another elements.
+   *
+   * @see dupElements
+   * @param m the elements to add the e
+   * @param e the elements to be added to m
+   */
   static void addToElements(elements** m,elements* e){
     elements* tmp=e;
@@ -948,4 +1271,9 @@
   }
 
+  /**
+   * Dump a service on stderr
+   *
+   * @param s the service to dump
+   */
   static void dumpService(service* s){
     fprintf(stderr,"++++++++++++++++++\nSERVICE [%s]\n++++++++++++++++++\n",s->name);
@@ -967,4 +1295,9 @@
   }
 
+  /**
+   * Dump a service on stderr using the YAML syntaxe
+   *
+   * @param s the service to dump
+   */
   static void dumpServiceAsYAML(service* s){
     int i;
@@ -994,4 +1327,10 @@
   }
 
+  /**
+   * Convert a maps to a char*** (only used for Fortran support)
+   *
+   * @param m the maps to convert
+   * @param c the resulting array
+   */
   static void mapsToCharXXX(maps* m,char*** c){
     maps* tm=m;
@@ -1024,4 +1363,10 @@
   }
 
+  /**
+   * Convert a char*** to a maps (only used for Fortran support)
+   *
+   * @param c the array to convert
+   * @param m the resulting maps
+   */
   static void charxxxToMaps(char*** c,maps**m){
     maps* trorf=*m;
Index: /trunk/zoo-project/zoo-kernel/service_internal.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal.c	(revision 578)
+++ /trunk/zoo-project/zoo-kernel/service_internal.c	(revision 579)
@@ -1,3 +1,3 @@
-/**
+/*
  * Author : Gérald FENOY
  *
@@ -43,4 +43,12 @@
 #define ERROR_MSG_MAX_LENGTH 1024
 
+/**
+ * Verify if a given language is listed in the lang list defined in the [main] 
+ * section of the main.cfg file.
+ * 
+ * @param conf the map containing the settings from the main.cfg file
+ * @param str the specific language
+ * @return 1 if the specific language is listed, -1 in other case.
+ */
 int isValidLang(maps* conf,const char *str){
   map *tmpMap=getMapFromMaps(conf,"main","lang");
@@ -59,4 +67,9 @@
 }
 
+/**
+ * Print the HTTP headers based on a map.
+ * 
+ * @param m the map containing the headers informations
+ */
 void printHeaders(maps* m){
   maps *_tmp=getMaps(m,"headers");
@@ -70,4 +83,10 @@
 }
 
+/**
+ * Add a land attribute to a XML node
+ *
+ * @param n the XML node to add the attribute
+ * @param m the map containing the language key to add as xml:lang
+ */
 void addLangAttr(xmlNodePtr n,maps *m){
   map *tmpLmap=getMapFromMaps(m,"main","language");
@@ -78,10 +97,20 @@
 }
 
-/* Converts a hex character to its integer value */
+/**
+ * Converts a hex character to its integer value 
+ *
+ * @param ch the char to convert
+ * @return the converted char 
+ */
 char from_hex(char ch) {
   return isdigit(ch) ? ch - '0' : tolower(ch) - 'a' + 10;
 }
 
-/* Converts an integer value to its hex character*/
+/**
+ * Converts an integer value to its hec character 
+ *
+ * @param code the char to convert
+ * @return the converted char 
+ */
 char to_hex(char code) {
   static char hex[] = "0123456789abcdef";
@@ -89,4 +118,11 @@
 }
 
+/**
+ * Get the ongoing status of a running service 
+ *
+ * @param conf the maps containing the setting of the main.cfg file
+ * @param pid the service identifier (usid key from the [lenv] section)
+ * @return the reported status char* (MESSAGE|POURCENTAGE)
+ */
 char* _getStatus(maps* conf,int pid){
   char lid[1024];
@@ -131,8 +167,7 @@
 
 size_t getKeyValue(maps* conf, char* key, size_t length){
-  
   if(conf==NULL) {
-	 strncpy(key, "700666", length);
-	 return strlen(key);
+    strncpy(key, "700666", length);
+    return strlen(key);
   }
   
@@ -148,5 +183,7 @@
   }
   return strlen(key);
-} 
+}
+
+
 semid getShmLockId(maps* conf, int nsems){
     semid sem_id;
@@ -336,5 +373,8 @@
 
 #else
-
+/**
+ * Number of time to try to access a semaphores set
+ * @see getShmLockId
+ */
 #define MAX_RETRIES 10
 
@@ -347,4 +387,10 @@
 #endif
 
+/**
+ * Set in the pre-allocated key the zoo_sem_[SID] string 
+ * where [SID] is the lid (if any) or usid value from the [lenv] section.
+ *
+ * @param conf the map containing the setting of the main.cfg file
+ */
 int getKeyValue(maps* conf){
   if(conf==NULL)
@@ -359,4 +405,12 @@
 }
 
+/**
+ * Try to create or access a semaphore set.
+ *
+ * @see getKeyValue
+ * @param conf the map containing the setting of the main.cfg file
+ * @param nsems number of semaphores
+ * @return a semaphores set indentifier on success, -1 in other case
+ */
 int getShmLockId(maps* conf, int nsems){
     int i;
@@ -422,4 +476,11 @@
 }
 
+/**
+ * Try to remove a semaphore set.
+ *
+ * @param conf the map containing the setting of the main.cfg file
+ * @param nsems number of semaphores
+ * @return 0 if the semaphore can be removed, -1 in other case.
+ */
 int removeShmLock(maps* conf, int nsems){
   union semun arg;
@@ -432,4 +493,10 @@
 }
 
+/**
+ * Lock a semaphore set.
+ *
+ * @param id the semaphores set indetifier
+ * @return 0 if the semaphore can be locked, -1 in other case.
+ */
 int lockShm(int id){
   struct sembuf sb;
@@ -444,4 +511,10 @@
 }
 
+/**
+ * unLock a semaphore set.
+ *
+ * @param id the semaphores set indetifier
+ * @return 0 if the semaphore can be locked, -1 in other case.
+ */
 int unlockShm(int id){
   struct sembuf sb;
@@ -456,4 +529,9 @@
 }
 
+/**
+ * Stop handling status repport.
+ *
+ * @param conf the map containing the setting of the main.cfg file
+ */
 void unhandleStatus(maps *conf){
   int shmid;
@@ -481,4 +559,11 @@
 }
 
+/**
+ * Update the current of the running service.
+ *
+ * @see getKeyValue, getShmLockId, lockShm
+ * @param conf the map containing the setting of the main.cfg file
+ * @return 0 on success, -2 if shmget failed, -1 if shmat failed
+ */
 int _updateStatus(maps *conf){
   int shmid;
@@ -528,4 +613,11 @@
 }
 
+/**
+ * Update the current of the running service.
+ *
+ * @see getKeyValue, getShmLockId, lockShm
+ * @param pid the semaphores 
+ * @return 0 on success, -2 if shmget failed, -1 if shmat failed
+ */
 char* getStatus(int pid){
   int shmid;
@@ -594,7 +686,11 @@
 
 
-
-/* Returns a url-encoded version of str */
-/* IMPORTANT: be sure to free() the returned string after use */
+/**
+ * URLEncode an url
+ *
+ * @param str the url to encode
+ * @return a url-encoded version of str
+ * @warning be sure to free() the returned string after use
+ */
 char *url_encode(char *str) {
   char *pstr = str, *buf = (char*) malloc(strlen(str) * 3 + 1), *pbuf = buf;
@@ -612,6 +708,11 @@
 }
 
-/* Returns a url-decoded version of str */
-/* IMPORTANT: be sure to free() the returned string after use */
+/**
+ * Decode an URLEncoded url
+ *
+ * @param str the URLEncoded url to decode
+ * @return a url-decoded version of str
+ * @warning be sure to free() the returned string after use
+ */
 char *url_decode(char *str) {
   char *pstr = str, *buf = (char*) malloc(strlen(str) + 1), *pbuf = buf;
@@ -633,4 +734,11 @@
 }
 
+/**
+ * Replace the first letter by its upper case version in a new char array
+ *
+ * @param tmp the char*
+ * @return a new char* with first letter in upper case
+ * @warning be sure to free() the returned string after use
+ */
 char *zCapitalize1(char *tmp){
   char *res=zStrdup(tmp);
@@ -640,4 +748,11 @@
 }
 
+/**
+ * Replace all letters by their upper case version in a new char array
+ *
+ * @param tmp the char*
+ * @return a new char* with first letter in upper case
+ * @warning be sure to free() the returned string after use
+ */
 char *zCapitalize(char *tmp){
   int i=0;
@@ -649,5 +764,10 @@
 }
 
-
+/**
+ * Search for an existing XML namespace in usedNS.
+ * 
+ * @param name the name of the XML namespace to search
+ * @return the index of the XML namespace found or -1 if not found.
+ */
 int zooXmlSearchForNs(const char* name){
   int i;
@@ -661,4 +781,12 @@
 }
 
+/**
+ * Add an XML namespace to the usedNS if it was not already used.
+ * 
+ * @param nr the xmlNodePtr to attach the XML namspace (can be NULL)
+ * @param url the url of the XML namespace to add
+ * @param name the name of the XML namespace to add
+ * @return the index of the XML namespace added.
+ */
 int zooXmlAddNs(xmlNodePtr nr,const char* url,const char* name){
 #ifdef DEBUG
@@ -683,4 +811,7 @@
 }
 
+/**
+ * Free allocated memory to store used XML namespace.
+ */
 void zooXmlCleanupNs(){
   int j;
@@ -700,5 +831,10 @@
 }
 
-
+/**
+ * Add a XML document to the iDocs.
+ * 
+ * @param value the string containing the XML document
+ * @return the index of the XML document added.
+ */
 int zooXmlAddDoc(const char* value){
   int currId=0;
@@ -709,4 +845,7 @@
 }
 
+/**
+ * Free allocated memort to store XML documents
+ */
 void zooXmlCleanupDocs(){
   int j;
@@ -716,9 +855,4 @@
   nbDocs=0;
 }
-
-
-/************************************************************************/
-/*                             soapEnvelope()                           */
-/************************************************************************/
 
 /**
@@ -755,8 +889,4 @@
 }
 
-/************************************************************************/
-/*                            printWPSHeader()                          */
-/************************************************************************/
-
 /**
  * Generate a WPS header.
@@ -794,8 +924,4 @@
   return n;
 }
-
-/************************************************************************/
-/*                     printGetCapabilitiesHeader()                     */
-/************************************************************************/
 
 /**
@@ -1095,5 +1221,11 @@
 }
 
-
+/**
+ * Add prefix to the service name.
+ * 
+ * @param conf the conf maps containing the main.cfg settings
+ * @param level the map containing the level information
+ * @param serv the service structure created from the zcfg file
+ */
 void addPrefix(maps* conf,map* level,service* serv){
   if(level!=NULL){
@@ -1128,4 +1260,12 @@
 }
 
+/**
+ * Generate a wps:Process node for a servie and add it to a given node.
+ * 
+ * @param m the conf maps containing the main.cfg settings
+ * @param nc the XML node to add the Process node
+ * @param serv the service structure created from the zcfg file
+ * @return the generated wps:ProcessOfferings xmlNodePtr 
+ */
 void printGetCapabilitiesForProcess(maps* m,xmlNodePtr nc,service* serv){
   xmlNsPtr ns,ns_ows,ns_xlink;
@@ -1161,4 +1301,12 @@
 }
 
+/**
+ * Generate a ProcessDescription node for a servie and add it to a given node.
+ * 
+ * @param m the conf maps containing the main.cfg settings
+ * @param nc the XML node to add the Process node
+ * @param serv the servive structure created from the zcfg file
+ * @return the generated wps:ProcessOfferings xmlNodePtr 
+ */
 void printDescribeProcessForProcess(maps* m,xmlNodePtr nc,service* serv){
   xmlNsPtr ns,ns_ows,ns_xlink;
@@ -1230,4 +1378,14 @@
 }
 
+/**
+ * Generate the required XML tree for the detailled metadata informations of 
+ * inputs or outputs
+ *
+ * @param in 1 in case of inputs, 0 for outputs
+ * @param elem the elements structure containing the metadata informations
+ * @param type the name ("Input" or "Output") of the XML node to create
+ * @param ns_ows the ows XML namespace
+ * @param nc1 the XML node to use to add the created tree
+ */
 void printFullDescription(int in,elements *elem,const char* type,xmlNsPtr ns_ows,xmlNodePtr nc1){
   const char *orderedFields[13];
@@ -1686,4 +1844,16 @@
 }
 
+/**
+ * Generate a wps:Execute XML document.
+ * 
+ * @param m the conf maps containing the main.cfg settings
+ * @param request the map representing the HTTP request
+ * @param pid the process identifier linked to a service
+ * @param serv the serv structure created from the zcfg file
+ * @param service the service name
+ * @param status the status returned by the service
+ * @param inputs the inputs provided
+ * @param outputs the outputs generated by the service
+ */
 void printProcessResponse(maps* m,map* request, int pid,service* serv,const char* service,int status,maps* inputs,maps* outputs){
   xmlNsPtr ns,ns_ows,ns_xlink;
@@ -1966,5 +2136,11 @@
 }
 
-
+/**
+ * Print a XML document.
+ * 
+ * @param m the conf maps containing the main.cfg settings
+ * @param doc the XML document
+ * @param pid the process identifier linked to a service
+ */
 void printDocument(maps* m, xmlDocPtr doc,int pid){
   char *encoding=getEncoding(m);
@@ -1992,4 +2168,15 @@
 }
 
+/**
+ * Print a XML document.
+ * 
+ * @param doc the XML document (unused)
+ * @param nc the XML node to add the output definition
+ * @param ns_wps the wps XML namespace
+ * @param ns_ows the ows XML namespace
+ * @param e the output elements 
+ * @param m the conf maps containing the main.cfg settings
+ * @param type the type (unused)
+ */
 void printOutputDefinitions(xmlDocPtr doc,xmlNodePtr nc,xmlNsPtr ns_wps,xmlNsPtr ns_ows,elements* e,maps* m,const char* type){
   xmlNodePtr nc1;
@@ -2024,4 +2211,16 @@
 }
 
+/**
+ * Generate XML nodes describing inputs or outputs metadata.
+ * 
+ * @param doc the XML document 
+ * @param nc the XML node to add the definition
+ * @param ns_wps the wps namespace
+ * @param ns_ows the ows namespace
+ * @param ns_xlink the xlink namespace
+ * @param e the output elements 
+ * @param m the conf maps containing the main.cfg settings
+ * @param type the type
+ */
 void printIOType(xmlDocPtr doc,xmlNodePtr nc,xmlNsPtr ns_wps,xmlNsPtr ns_ows,xmlNsPtr ns_xlink,elements* e,maps* m,const char* type){
   xmlNodePtr nc1,nc2,nc3;
@@ -2258,4 +2457,12 @@
 }
 
+/**
+ * Create XML node with basic ows metadata informations (Identifier,Title,Abstract)
+ *
+ * @param root the root XML node to add the description
+ * @param ns_ows the ows XML namespace
+ * @param identifier the identifier to use
+ * @param amap the map containing the ows metadata informations 
+ */
 void printDescription(xmlNodePtr root,xmlNsPtr ns_ows,const char* identifier,map* amap){
   xmlNodePtr nc2 = xmlNewNode(ns_ows, BAD_CAST "Identifier");
@@ -2278,4 +2485,11 @@
 }
 
+/**
+ * Access the value of the encoding key in a maps
+ *
+ * @param m the maps to search for the encoding key
+ * @return the value of the encoding key in a maps if encoding key exists,
+ *  "UTF-8" in other case.
+ */
 char* getEncoding(maps* m){
   if(m!=NULL){
@@ -2291,4 +2505,11 @@
 }
 
+/**
+ * Access the value of the version key in a maps
+ *
+ * @param m the maps to search for the version key
+ * @return the value of the version key in a maps if encoding key exists,
+ *  "1.0.0" in other case.
+ */
 char* getVersion(maps* m){
   if(m!=NULL){
@@ -2304,8 +2525,4 @@
 }
 
-/************************************************************************/
-/*                    printExceptionReportResponse()                    */
-/************************************************************************/
-
 /**
  * Print an OWS ExceptionReport Document and HTTP headers (when required) 
@@ -2313,5 +2530,5 @@
  * Set hasPrinted value to true in the [lenv] section.
  * 
- * @param m the conf maps
+ * @param m the maps containing the settings of the main.cfg file
  * @param s the map containing the text,code,locator keys
  */
@@ -2375,8 +2592,4 @@
     setMapInMaps(m,"lenv","hasPrinted","true");
 }
-
-/************************************************************************/
-/*                      createExceptionReportNode()                     */
-/************************************************************************/
 
 /**
@@ -2448,8 +2661,4 @@
 }
 
-/************************************************************************/
-/*                           errorException()                           */
-/************************************************************************/
-
 /**
  * Print an OWS ExceptionReport.
@@ -2474,8 +2683,4 @@
 }
 
-/************************************************************************/
-/*                          readGeneratedFile()                         */
-/************************************************************************/
-
 /**
  * Read a file generated by a service.
@@ -2511,4 +2716,15 @@
 }
 
+/**
+ * Generate the output response (RawDataOutput or ResponseDocument)
+ *
+ * @param s the service structure containing the metadata informations
+ * @param request_inputs the inputs provided to the service for execution
+ * @param request_outputs the outputs updated by the service execution
+ * @param request_inputs1 the map containing the HTTP request
+ * @param cpid the process identifier attached to a service execution
+ * @param m the conf maps containing the main.cfg settings
+ * @param res the value returned by the service execution
+ */
 void outputResponse(service* s,maps* request_inputs,maps* request_outputs,
 		    map* request_inputs1,int cpid,maps* m,int res){
@@ -2795,4 +3011,13 @@
 }
 
+
+/**
+ * Base64 encoding of a char*
+ *
+ * @param input the value to encode
+ * @param length the value length
+ * @return the buffer containing the base64 value
+ * @warning make sure to free the returned value
+ */
 char *base64(const char *input, int length)
 {
@@ -2817,4 +3042,13 @@
 }
 
+/**
+ * Base64 decoding of a char*
+ *
+ * @param input the value to decode
+ * @param length the value length
+ * @param red the value length
+ * @return the buffer containing the base64 value 
+ * @warning make sure to free the returned value
+ */
 char *base64d(const char *input, int length,int* red)
 {
@@ -2836,4 +3070,9 @@
 }
 
+/**
+ * Make sure that each value encoded in base64 in a maps is decoded.
+ *
+ * @param in the maps containing the values
+ */
 void ensureDecodedBase64(maps **in){
   maps* cursor=*in;
@@ -2856,4 +3095,17 @@
 }
 
+/**
+ * Add the default values defined in the zcfg to a maps.
+ *
+ * @param out the maps containing the inputs or outputs given in the initial
+ *  HTTP request
+ * @param in the description of all inputs or outputs available for a service
+ * @param m the maps containing the settings of the main.cfg file
+ * @param type 0 for inputs and 1 for outputs
+ * @param err the map to store potential missing mandatory input parameters or
+ *  wrong output names depending on the type.
+ * @return "" if no error was detected, the name of last input or output causing
+ *  an error.
+ */
 char* addDefaultValues(maps** out,elements* in,maps* m,int type,map** err){
   map *res=*err;
@@ -3095,12 +3347,14 @@
 
 /**
- * parseBoundingBox : parse a BoundingBox string
- *
- * OGC 06-121r3 : 10.2 Bounding box
- *
- * value is provided as : lowerCorner,upperCorner,crs,dimension
- * exemple : 189000,834000,285000,962000,urn:ogc:def:crs:OGC:1.3:CRS84
- *
- * Need to create a map to store boundingbox informations :
+ * Parse a BoundingBox string
+ *
+ * [OGC 06-121r3](http://portal.opengeospatial.org/files/?artifact_id=20040):
+ *  10.2 Bounding box
+ * 
+ *
+ * Value is provided as : lowerCorner,upperCorner,crs,dimension
+ * Exemple : 189000,834000,285000,962000,urn:ogc:def:crs:OGC:1.3:CRS84
+ *
+ * A map to store boundingbox informations should contain:
  *  - lowerCorner : double,double (minimum within this bounding box)
  *  - upperCorner : double,double (maximum within this bounding box)
@@ -3109,4 +3363,7 @@
  * 
  * Note : support only 2D bounding box.
+ *
+ * @param value the char* containing the KVP bouding box
+ * @return a map containing all the bounding box keys
  */
 map* parseBoundingBox(const char* value){
@@ -3156,7 +3413,9 @@
 
 /**
- * printBoundingBox : fill a BoundingBox node (ows:BoundingBox or 
- * wps:BoundingBoxData). Set crs and dimensions attributes, add 
- * Lower/UpperCorner nodes to a pre-existing XML node.
+ * Create required XML nodes for boundingbox and update the current XML node
+ *
+ * @param ns_ows the ows XML namespace
+ * @param n the XML node to update
+ * @param boundingbox the map containing the boundingbox definition
  */
 void printBoundingBox(xmlNsPtr ns_ows,xmlNodePtr n,map* boundingbox){
@@ -3191,4 +3450,12 @@
 }
 
+/**
+ * Print an ows:BoundingBox XML document
+ *
+ * @param m the maps containing the settings of the main.cfg file
+ * @param boundingbox the maps containing the boundingbox definition
+ * @param file the file to print the BoundingBox (if NULL then print on stdout)
+ * @see parseBoundingBox, printBoundingBox
+ */
 void printBoundingBoxDocument(maps* m,maps* boundingbox,FILE* file){
   if(file==NULL)
@@ -3243,5 +3510,11 @@
 }
 
-
+/**
+ * Compute md5
+ * 
+ * @param url the char* 
+ * @return a char* representing the md5 of the url
+ * @warning make sure to free ressources returned by this function
+ */
 char* getMd5(char* url){
   EVP_MD_CTX md5ctx;
@@ -3267,5 +3540,13 @@
 
 /**
- * Cache a file for a given request
+ * Cache a file for a given request.
+ * For each cached file, the are two files stored, a .zca and a .zcm containing
+ * the downloaded content and the mimeType respectively. 
+ *
+ * @param conf the maps containing the settings of the main.cfg file
+ * @param request the url used too fetch the content
+ * @param content the downloaded content
+ * @param mimeType the content mimeType 
+ * @param length the content size
  */
 void addToCache(maps* conf,char* request,char* content,char* mimeType,int length){
@@ -3300,4 +3581,12 @@
 }
 
+/**
+ * Verify if a url is available in the cache
+ *
+ * @param conf the maps containing the settings of the main.cfg file
+ * @param request the url
+ * @return the full name of the cached file if any, NULL in other case
+ * @warning make sure to free ressources returned by this function (if not NULL)
+ */
 char* isInCache(maps* conf,char* request){
   map* tmpM=getMapFromMaps(conf,"main","cacheDir");
@@ -3321,4 +3610,13 @@
 }
 
+/**
+ * Effectively run all the HTTP requests in the queue
+ *
+ * @param m the maps containing the settings of the main.cfg file
+ * @param inputs the maps containing the inputs (defined in the requests+added
+ *  per default based on the zcfg file)
+ * @param hInternet the HINTERNET pointer
+ * @return 0 on success
+ */
 int runHttpRequests(maps** m,maps** inputs,HINTERNET* hInternet){
   if(hInternet->nb>0){
@@ -3427,6 +3725,11 @@
 
 /**
- * loadRemoteFile:
  * Try to load file from cache or download a remote file if not in cache
+ *
+ * @param m the maps containing the settings of the main.cfg file
+ * @param content the map to update
+ * @param hInternet the HINTERNET pointer
+ * @param url the url to fetch
+ * @return 0
  */
 int loadRemoteFile(maps** m,map** content,HINTERNET* hInternet,char *url){
@@ -3523,4 +3826,11 @@
 }
 
+/**
+ * Read a file using the GDAL VSI API 
+ *
+ * @param conf the maps containing the settings of the main.cfg file
+ * @param dataSource the datasource name to read
+ * @warning make sure to free ressources returned by this function
+ */
 char *readVSIFile(maps* conf,const char* dataSource){
     VSILFILE * fichier=VSIFOpenL(dataSource,"rb");
@@ -3542,4 +3852,16 @@
 }
 
+/**
+ * Extract the service identifier from the full service identifier
+ * ie: 
+ *  - Full service name: OTB.BandMath
+ *  - Service name: BandMath
+ *
+ * @param conf the maps containing the settings of the main.cfg file
+ * @param conf_dir the full path to the ZOO-Kernel directory
+ * @param identifier the full service name (potentialy including a prefix, ie:
+ *  Prefix.MyService)
+ * @param buffer the resulting service identifier (without any prefix)
+ */
 void parseIdentifier(maps* conf,char* conf_dir,char *identifier,char* buffer){
   setMapInMaps(conf,"lenv","oIdentifier",identifier);
@@ -3607,4 +3929,13 @@
 }
 
+/**
+ * Update the status of an ongoing service 
+ *
+ * @param conf the maps containing the settings of the main.cfg file
+ * @param percentCompleted percentage of completude of execution of the service
+ * @param message information about the current step executed
+ * @return the value of _updateStatus
+ * @see _updateStatus
+ */
 int updateStatus( maps* conf, const int percentCompleted, const char* message ){
   char tmp[4];
@@ -3615,4 +3946,13 @@
 }
 
+/**
+ * Access an input value 
+ *
+ * @param inputs the maps to search for the input value
+ * @param parameterName the input name to fetch the value
+ * @param numberOfBytes the resulting size of the value to add (for binary
+ *  values), -1 for basic char* data
+ * @return a pointer to the input value if found, NULL in other case.
+ */
 char* getInputValue( maps* inputs, const char* parameterName, size_t* numberOfBytes){
   map* res=getMapFromMaps(inputs,parameterName,"value");
@@ -3630,4 +3970,14 @@
 }
 
+/**
+ * Set an output value 
+ *
+ * @param outputs the maps to define the output value
+ * @param parameterName the output name to set the value
+ * @param data the value to set
+ * @param numberOfBytes size of the value to add (for binary values), -1 for
+ *  basic char* data
+ * @return 0
+ */
 int  setOutputValue( maps* outputs, const char* parameterName, char* data, size_t numberOfBytes ){
   if(numberOfBytes==-1){
@@ -3649,8 +3999,4 @@
 }
 
-/************************************************************************/
-/*                           checkValidValue()                          */
-/************************************************************************/
-
 /**
  * Verify if a parameter value is valid.
@@ -3658,4 +4004,5 @@
  * @param request the request map
  * @param res the error map potentially generated
+ * @param toCheck the parameter to use
  * @param avalues the acceptable values (or null if testing only for presence)
  * @param mandatory verify the presence of the parameter if mandatory > 0 
@@ -3740,38 +4087,42 @@
 }
 
-/* 
- * The character string returned from getLastErrorMessage resides
+/**
+ * Access the last error message returned by the OS when trying to dynamically
+ * load a shared library.
+ *
+ * @return the last error message
+ * @warning The character string returned from getLastErrorMessage resides
  * in a static buffer. The application should not write to this
  * buffer or attempt to free() it.
  */ 
-char* getLastErrorMessage() {                                                                                                                                                    
-#ifdef WIN32	
-	LPVOID lpMsgBuf;
-	DWORD errCode = GetLastError();
-	static char msg[ERROR_MSG_MAX_LENGTH];
-	size_t i;
-
-	DWORD length = FormatMessage(
-					 FORMAT_MESSAGE_ALLOCATE_BUFFER | 
-					 FORMAT_MESSAGE_FROM_SYSTEM |
-					 FORMAT_MESSAGE_IGNORE_INSERTS,
-					 NULL,
-					 errCode,
-					 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-					 (LPTSTR) &lpMsgBuf,
-					 0, NULL );	
-	
-	#ifdef UNICODE		
-		wcstombs_s( &i, msg, ERROR_MSG_MAX_LENGTH,
-					(wchar_t*) lpMsgBuf, _TRUNCATE );
-	#else
-		strcpy_s( msg, ERROR_MSG_MAX_LENGTH,
-	              (char *) lpMsgBuf );		
-	#endif	
-	LocalFree(lpMsgBuf);
-	
-	return msg;
+char* getLastErrorMessage() {                                              
+#ifdef WIN32
+  LPVOID lpMsgBuf;
+  DWORD errCode = GetLastError();
+  static char msg[ERROR_MSG_MAX_LENGTH];
+  size_t i;
+  
+  DWORD length = FormatMessage(
+			       FORMAT_MESSAGE_ALLOCATE_BUFFER | 
+			       FORMAT_MESSAGE_FROM_SYSTEM |
+			       FORMAT_MESSAGE_IGNORE_INSERTS,
+			       NULL,
+			       errCode,
+			       MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+			       (LPTSTR) &lpMsgBuf,
+			       0, NULL );	
+  
+#ifdef UNICODE		
+  wcstombs_s( &i, msg, ERROR_MSG_MAX_LENGTH,
+	      (wchar_t*) lpMsgBuf, _TRUNCATE );
 #else
-	return dlerror();
-#endif
-}
+  strcpy_s( msg, ERROR_MSG_MAX_LENGTH,
+	    (char *) lpMsgBuf );		
+#endif	
+  LocalFree(lpMsgBuf);
+  
+  return msg;
+#else
+  return dlerror();
+#endif
+}
Index: /trunk/zoo-project/zoo-kernel/service_internal.h
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal.h	(revision 578)
+++ /trunk/zoo-project/zoo-kernel/service_internal.h	(revision 579)
@@ -1,3 +1,3 @@
-/**
+/*
  * Author : Gérald FENOY
  *
@@ -28,14 +28,35 @@
 #pragma once 
 
+/**
+ * The default service url (overriden by serverAddress)
+ */
 #define DEFAULT_SERVICE_URL "http://www.zoo-project.org/"
+/**
+ * The time size
+ */
 #define TIME_SIZE 40
 
 #include <libintl.h>
 #include <locale.h>
+/**
+ * ZOO-Kernel internal messages translation function
+ */
 #define _(String) dgettext ("zoo-kernel",String)
+/**
+ * ZOO-Services messages translation function
+ */
 #define _ss(String) dgettext ("zoo-services",String)
 
+/**
+ * ZOO-Kernel was unable to create a lock
+ */
 #define ZOO_LOCK_CREATE_FAILED -4
+/**
+ * ZOO-Kernel was unable to acquire a lock
+ */
 #define ZOO_LOCK_ACQUIRE_FAILED -5
+/**
+ * ZOO-Kernel was unable to release a lock
+ */
 #define ZOO_LOCK_RELEASE_FAILED -6
 
@@ -89,9 +110,36 @@
 #include <libxml/xpath.h>
 
+  /**
+   * Maximum number of XML namespaces
+   */
+#define ZOO_NS_MAX 10
+  /**
+   * Maximum number of XML docs
+   */
+#define ZOO_DOC_MAX 20
+
+  /**
+   * Global char* to store the serverAddress value of the mmmmmain section
+   */
   static char* SERVICE_URL;
-  static xmlNsPtr usedNs[10];
-  static char* nsName[10];
-  static xmlDocPtr iDocs[10];
+  /**
+   * Array of xmlNsPtr storing all used XML namespace
+   */
+  static xmlNsPtr usedNs[ZOO_NS_MAX];
+  /**
+   * Array storing names of the used XML namespace
+   */
+  static char* nsName[ZOO_NS_MAX];
+  /**
+   * Number of XML namespaces
+   */
   static int nbNs=0;
+  /**
+   * Array of xmlDocPtr storing XML docs
+   */
+  static xmlDocPtr iDocs[ZOO_DOC_MAX];
+  /**
+   * Number of XML docs
+   */
   static int nbDocs=0;
 
@@ -107,4 +155,7 @@
   char* getStatus(int);
   int removeShmLock(maps*, int);
+  /**
+   * Cross platform type used for Lock identifier
+   */
 #ifndef WIN32
 #define semid int
Index: /trunk/zoo-project/zoo-kernel/service_internal_ms.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal_ms.c	(revision 578)
+++ /trunk/zoo-project/zoo-kernel/service_internal_ms.c	(revision 579)
@@ -1,3 +1,3 @@
-/**
+/*
  * Author : Gérald FENOY
  *
Index: /trunk/zoo-project/zoo-kernel/service_internal_ms.h
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal_ms.h	(revision 578)
+++ /trunk/zoo-project/zoo-kernel/service_internal_ms.h	(revision 579)
@@ -1,3 +1,3 @@
-/**
+/*
  * Author : Gérald FENOY
  *
Index: /trunk/zoo-project/zoo-kernel/service_internal_python.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal_python.c	(revision 578)
+++ /trunk/zoo-project/zoo-kernel/service_internal_python.c	(revision 579)
@@ -1,3 +1,3 @@
-/**
+/*
  * Author : Gérald FENOY
  *
@@ -25,6 +25,9 @@
 #include "service_internal_python.h"
 
+/**
+ * The state for the zoo Python module
+ */
 struct module_state {
-    PyObject *error;
+   PyObject *error;
 };
 
@@ -43,6 +46,18 @@
 #endif
 
+/**
+ * The exception for the zoo Python module
+ */
 static PyObject* ZooError;
 
+/**
+ * Function definitions for the zoo Python Module
+ *
+ * Define the following functions available from a service loaded and running
+ * from the ZOO-Kernel Python environment:
+ *  - "_" corresponding to the PythonTranslate function
+ *  - "updte_status" corresponding to the PythonUpdateStatus function
+ * @see PythonTranslate, PythonUpdateStatus
+ */
 PyMethodDef zooMethods[] = {
   {"_", PythonTranslate, METH_VARARGS, "Translate a string using the zoo-services textdomain."},
@@ -76,4 +91,9 @@
 #endif
 
+/**
+ * Function to create and initialize the zoo Python module
+ *
+ * @return the Python module (for Python versions < 3, nothing for version >=3)
+ */
 PyMODINIT_FUNC init_zoo(){
   PyObject *tmp,*d;
@@ -115,4 +135,14 @@
 }
 
+/**
+ * Loading a Python module then run the function corresponding to the service
+ * by passing the conf, inputs and outputs parameters by reference. 
+ *
+ * @param main_conf the conf maps containing the main.cfg settings
+ * @param request the map containing the HTTP request
+ * @param s the service structure
+ * @param real_inputs the maps containing the inputs
+ * @param real_outputs the maps containing the outputs
+ */
 int zoo_python_support(maps** main_conf,map* request,service* s,maps **real_inputs,maps **real_outputs){
   char *pythonpath;
@@ -271,4 +301,12 @@
 }
 
+/**
+ * Repport Python error which may occur on loading the Python module or at 
+ * runtime.
+ * 
+ * @param m the conf maps containing the main.cfg settings
+ * @param module the service name
+ * @param load 1 if the Python module was not loaded yet
+ */
 void PythonZooReport(maps* m,const char* module,int load){
   PyObject *pName, *pModule, *pFunc;
@@ -335,4 +373,12 @@
 }
 
+/**
+ * Convert a maps to a Python dictionary
+ *
+ * @param t the maps to convert
+ * @return a new PyDictObject containing the converted maps
+ * @see PyDict_FromMap
+ * @warning make sure to free ressources returned by this function
+ */
 PyDictObject* PyDict_FromMaps(maps* t){
   PyObject* res=PyDict_New( );
@@ -351,4 +397,11 @@
 }
 
+/**
+ * Convert a map to a Python dictionary
+ *
+ * @param t the map to convert
+ * @return a new PyDictObject containing the converted maps
+ * @warning make sure to free ressources returned by this function
+ */
 PyDictObject* PyDict_FromMap(map* t){
   PyObject* res=PyDict_New( );
@@ -461,4 +514,11 @@
 }
 
+/**
+ * Convert a Python dictionary to a maps 
+ *
+ * @param t the PyDictObject to convert
+ * @return a new maps containing the converted PyDictObject
+ * @warning make sure to free ressources returned by this function
+ */
 maps* mapsFromPyDict(PyDictObject* t){
   maps* res=NULL;
@@ -501,4 +561,11 @@
 }
 
+/**
+ * Convert a Python dictionary to a map 
+ *
+ * @param t the PyDictObject to convert
+ * @return a new map containing the converted PyDictObject
+ * @warning make sure to free ressources returned by this function
+ */
 map* mapFromPyDict(PyDictObject* t){
   map* res=NULL;
@@ -540,4 +607,14 @@
 }
 
+/**
+ * Use the ZOO-Services messages translation function  from the Python
+ * environment
+ *
+ * @param self the Python object on which we can run the method
+ * @param args the Python arguments given from the Python environment
+ * @return a new Python string containing the translated value to the Python
+ *  environment
+ * @see _ss
+ */
 PyObject*
 PythonTranslate(PyObject* self, PyObject* args)
@@ -553,4 +630,12 @@
 }
 
+/**
+ * Update the ongoing status of a running service from the Python environment
+ *
+ * @param self the Python object on which we can run the method
+ * @param args the Python arguments given from the Python environment
+ * @return None to the Python environment
+ * @see _updateStatus
+ */
 PyObject*
 PythonUpdateStatus(PyObject* self, PyObject* args)
Index: /trunk/zoo-project/zoo-kernel/service_internal_python.h
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal_python.h	(revision 578)
+++ /trunk/zoo-project/zoo-kernel/service_internal_python.h	(revision 579)
@@ -1,3 +1,3 @@
-/**
+/*
  * Author : Gérald FENOY
  *
@@ -40,5 +40,4 @@
 
 maps* mapsFromPyDict(PyDictObject* t);
-void createMapsFromPyDict(maps**,PyDictObject*);
 map* mapFromPyDict(PyDictObject* t);
 
Index: /trunk/zoo-project/zoo-kernel/ulinet.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/ulinet.c	(revision 578)
+++ /trunk/zoo-project/zoo-kernel/ulinet.c	(revision 579)
@@ -1,8 +1,8 @@
-/**
+/*
  *  ulinet.c
  *
  * Author : Gérald FENOY
  *
- * Copyright (c) 2008-2010 GeoLabs SARL
+ * Copyright (c) 2008-2015 GeoLabs SARL
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -30,5 +30,14 @@
 #include "ulinet.h"
 #include <assert.h>
-  
+
+/**
+ * Write the downloaded content to a _HINTERNET structure
+ *
+ * @param buffer the buffer to read
+ * @param size size of each member
+ * @param nmemb number of element to read
+ * @param data the _HINTERNET structure to write in
+ * @return the size red, -1 if buffer is NULL
+ */
 size_t write_data_into(void *buffer, size_t size, size_t nmemb, void *data){
   size_t realsize = size * nmemb;
@@ -58,4 +67,15 @@
 }
 
+/**
+ * In case of presence of "Set-Cookie" in the headers red, store the cookie
+ * identifier in CCookie
+ *
+ * @param buffer the buffer to read
+ * @param size size of each member
+ * @param nmemb number of element to read
+ * @param data the _HINTERNET structure to write in
+ * @return the size red, -1 if buffer is NULL
+ * @see CCookie
+ */
 size_t header_write_data(void *buffer, size_t size, size_t nmemb, void *data){
   if(strncmp("Set-Cookie: ",(char*)buffer,12)==0){
@@ -82,6 +102,16 @@
 };
 
-
+/**
+ * Define the proxy to use for a CURL handler
+ * 
+ * @param handle the CURL handler
+ * @param host the proxy host (including http://)
+ * @param port the proxy port
+ */
 void setProxy(CURL* handle,char* host,long port){
+  char* proxyDef=(char*)malloc((strlen(host)+10+2)*sizeof(char));
+  sprintf(proxyDef,"%s:%ld",host,port);
+  curl_easy_setopt(handle,CURLOPT_PROXY,proxyDef);
+  free(proxyDef);
 }
 
@@ -154,5 +184,8 @@
 #else
 /**
- * Linux (Gnome)
+ * Should autodetect the proxy configuration (do nothing on linux)
+ *
+ * @param handle a CURL handle
+ * @param proto the protocol requiring the use of a proxy
  */
 bool setProxiesForProtcol(CURL* handle,const char *proto){
@@ -164,4 +197,15 @@
 #endif
 
+/**
+ * Create a HINTERNET
+ *
+ * @param lpszAgent the HTPP User-Agent to use to send requests
+ * @param  dwAccessType type of access required
+ * @param  lpszProxyName the name of the proxy server(s) to use 
+ * @param  lpszProxyBypass ip address or host names which should not be routed
+ *  through the proxy
+ * @param  dwFlags Options (INTERNET_FLAG_ASYNC,INTERNET_FLAG_FROM_CACHE,INTERNET_FLAG_OFFLINE)
+ * @return the created HINTERNET
+ */
 HINTERNET InternetOpen(char* lpszAgent,int dwAccessType,char* lpszProxyName,char* lpszProxyBypass,int dwFlags){
   HINTERNET ret;
@@ -173,4 +217,9 @@
 }
 
+/**
+ * Close a HINTERNET connection and free allocated ressources
+ *
+ * @param handle0 the HINTERNET connection to close
+ */
 void InternetCloseHandle(HINTERNET* handle0){
   int i=0;
@@ -200,4 +249,14 @@
 }
 
+/**
+ * Create a new element in the download queue
+ *
+ * @param hInternet the HINTERNET connection to add the download link
+ * @param lpszUrl the url to download
+ * @param lpszHeaders the additional headers to be sent to the HTTP server
+ * @param dwHeadersLength the size of the additional headers
+ * @param dwFlags desired download mode (INTERNET_FLAG_NO_CACHE_WRITE for not using cache file)
+ * @param dwContext not used
+ */
 HINTERNET InternetOpenUrl(HINTERNET* hInternet,LPCTSTR lpszUrl,LPCTSTR lpszHeaders,size_t dwHeadersLength,size_t dwFlags,size_t dwContext){
 
@@ -289,4 +348,10 @@
 };
 
+/**
+ * Download all opened urls in the queue
+ *
+ * @param hInternet the HINTERNET structure containing the queue
+ * @return 0
+ */
 int processDownloads(HINTERNET* hInternet){
   int still_running=0;
@@ -307,4 +372,11 @@
 }
 
+/**
+ * Initialize the CCookie for a specific index (hInternet.nb)
+ *
+ * @param hInternet the HINTERNET structure to know the CCookie index to reset
+ * @return 1
+ * @see HINTERNET
+ */
 int freeCookieList(HINTERNET hInternet){
   memset(&CCookie[hInternet.nb][0],0,1024);
@@ -315,4 +387,13 @@
 }
 
+/**
+ * Copy a downloaded content
+ * 
+ * @param hInternet the _HINTERNET structure
+ * @param lpBuffer the memory space to copy the downloaded content
+ * @param dwNumberOfBytesToRead the size of lpBuffer
+ * @param lpdwNumberOfBytesRead number of bytes red
+ * @return 1 on success, 0 if failure
+ */
 int InternetReadFile(_HINTERNET hInternet,LPVOID lpBuffer,int dwNumberOfBytesToRead, size_t *lpdwNumberOfBytesRead){
   int dwDataSize;
Index: /trunk/zoo-project/zoo-kernel/ulinet.h
===================================================================
--- /trunk/zoo-project/zoo-kernel/ulinet.h	(revision 578)
+++ /trunk/zoo-project/zoo-kernel/ulinet.h	(revision 579)
@@ -1,3 +1,3 @@
-/**
+/*
  * Author : Gérald FENOY
  *
@@ -56,5 +56,7 @@
 static char CCookie[MAX_REQ][1024];
 #else
-extern char HEADER[MAX_REQ][3072];
+/**
+ * The cookies found
+ */
 extern char CCookie[MAX_REQ][1024];
 #endif
@@ -64,44 +66,41 @@
 #endif
 
-  //static pthread_mutex_t hMutexConnect = PTHREAD_MUTEX_INITIALIZER;
-
-static char* waitingRequests[MAX_REQ];
-
 struct MemoryStruct {
-  char *memory;
-  size_t size;
+  char *memory; //!< the memory space to store data 
+  size_t size; //!< side of the memory space
 };
 
+  /**
+   * Individual CURL handler
+   */
 typedef struct {
-  CURL *handle;
-  struct curl_slist *header;
-  char* filename;
-  FILE* file;
-  size_t size;
-  unsigned char *pabyData;
-  char *mimeType;
-  int hasCacheFile;
-  int nDataLen;
-  int nDataAlloc;
-  int id;
+  CURL *handle; //!< the CURL handler
+  struct curl_slist *header; //!< the headers to send
+  char* filename; //!< the cached file name
+  FILE* file; //!< the file pointer
+  unsigned char *pabyData; //!< the downloaded content
+  char *mimeType; //!< the mimeType returned by the server
+  int hasCacheFile; //!< 1 if we used a cache file
+  int nDataLen; //!< the length of the downloaded content
+  int nDataAlloc; //!< 
+  int id; //!< The position of the element in the queue
 } _HINTERNET;
 
+  /**
+   * Multiple CURL handlers
+   */
 typedef struct {
-  CURLM *handle;
-  _HINTERNET ihandle[MAX_REQ];
-  char *waitingRequests[MAX_REQ];
-  char *agent;
-  int nb;
+  CURLM *handle; //!< the CURLM handler
+  _HINTERNET ihandle[MAX_REQ]; //!< individual handlers in the queue 
+  char *waitingRequests[MAX_REQ]; //!< request in the queue
+  char *agent; //!< The User-Agent to use for HTTP request
+  int nb; //!< number of element in the queue 
 } HINTERNET;
 
 size_t write_data_into(void *buffer, size_t size, size_t nmemb, void *data);
 
-size_t content_write_data(void *buffer, size_t size, size_t nmemb, void *data);
-
 size_t header_write_data(void *buffer, size_t size, size_t nmemb, void *data);
 
-
 void setProxy(CURL* handle,char* host,long port);
-
 
 #if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__))
Index: /trunk/zoo-project/zoo-kernel/zoo_service_loader.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 578)
+++ /trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 579)
@@ -2681,5 +2681,5 @@
                       {
               /**
-	       * Get every attribute from a Output node
+	       * Get every attribute from an Output node
 	       * mimeType, encoding, schema, uom, asReference
 	       */
