lcrzo_list(3)

NAME
lcrzo_list - lcrzo library : chained lists

CONTENTS
/*    Laurent Constantin's network library (lcrzo)
                 lcrzo_list module
  Functions herein allow to work on generic lists.
*/
/*-------------------------------------------------------------*/
/* definition of a lcrzo_list. You should not use its
   fields directly. */
typedef struct lcrzo_listelem lcrzo_listelem;
struct lcrzo_listelem {
  lcrzo_listelem *pnext;
  lcrzo_listelem *pprecedent;
  void *pelem;
};
typedef struct {
  lcrzo_listelem *pnext;
  lcrzo_listelem *pprecedent;
  lcrzo_uint32 sizeofelems;
  lcrzo_int32 elemcount;
  int (*pfunc_erase)(void *pelem);
} lcrzo_list;
/*-------------------------------------------------------------*/
/***************************************************************
 * Note about lcrzo_list :                                     *
 * A lcrzo_list is a double direction list. For example, a     *
 * containing 3 elements looks like this :                     *
 *                                                             *
 * .________________________________________________________.  *
 * | ,----------------------------------------------------. |  *
 * | |  _________   ___ +1 ___   ___ +2 ___   ___ +3 ___  | |  *
 * | `->| lcrzo |-->|lcrzo_li|-->|lcrzo_li|-->|lcrzo_li|--' |  *
 * |____| _list |<--| stelem |<--| stelem |<--| stelem |<---'  *
 *      `-------'   `-- -3 --'   `-- -2 --'   `-- -1 --'       *
 *                       |            |            |           *
 *                       |            |            |           *
 *                       V            V            V           *
 *                     elem1        elem2        elem3         *
 *                                                             *
 * Elements can be accessed using positive position or         *
 * negative position. For example, the element +1 is the same  *
 * than the element -3.                                        *
 *                                                             *
 * Elements which are put in the list (elem1, elem2, etc.) are *
 * COPIES of user's values. So, if the user want to stock :    *
 *  - integers, a copy on sizeof(int) bytes is put in the list *
 *  - structures containing static objects, a copy on          *
 *    sizeof(the_struct) bytes is put in the list              *
 *  - structures containing dynamic objects (pointers), a copy *
 *    of sizeof(the_struct) bytes is put in the list, BUT the  *
 *    pointed items are not put because they are out of the    *
 *    structure                                                *
 * So, to be able to remove object of the above third          *
 * category, user has to give an erase function.               *
 *                                                             *
 *      Element to stock            Need an erase function ?   *
 *	      int                             no               *
 *	      char                            no               *
 *    struct {int a, char b}                  no               *
 *    int* (integer poitner)           yes (need 1 free)       *
 *    struct {int *a, int *b}          yes (need 2 free)       *
 *            etc.                                             *
 *                                                             *
 * This technology is easy to use, except for the third        *
 * category.                                                   *
 ***************************************************************/
/**********************************************
 * Note about positions :                     *
 * Warning : 0 is an invalid value            *
 * Here are possible values for a position :  *
 *  +1 : first item                           *
 *  +2 : second item                          *
 *  ...                                       *
 * Moreover, we can count from the end :      *
 *  -1 : last item                            *
 *  -2 : last but one item                    *
 *  ...                                       *
 **********************************************/
/*-------------------------------------------------------------*/
/* Name : lcrzo_list_init
   Description :
     Initialize a lcrzo_list.
   Input parameter(s) :
     sizeofelems : size of elements which are to be put in the list
     *pfunc_erase : function needed to erase dynamic elements
                    This can be NULL
   Input/output parameter(s) :
   Output parameter(s) :
     *plist : lcrzo_list initialized
   Normal return values :
     LCRZO_ERR_OK : ok
   Examples :
    - list containing integers :
        lcrzo_list_init(&list, sizeof(int), NULL);
    - list containing structures :
        struct st{ int a; char b };
        lcrzo_list_init(&list, sizeof(struct st), NULL);
    - list containing structures with external pointers :
        struct st{ int a; char b; int *p};
        int erasefunc(void *pelem) {free(pelem->p);}
        lcrzo_list_init(&list, sizeof(struct st), &erasefunc);
*/
int lcrzo_list_init(lcrzo_list *plist,
		    lcrzo_uint32 sizeofelems,
		    int (*pfunc_erase)(void *pelem));
/* Name : lcrzo_list_close
   Description :
     Destroy a lcrzo_list.
   Input parameter(s) :
   Input/output parameter(s) :
     *plist : lcrzo_list to destroy
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_close(lcrzo_list *plist);
/*-------------------------------------------------------------*/
/* Name : lcrzo_list_add_pos
   Description :
     Add an element to the lcrzo_list.
   Input parameter(s) :
     position : position where the element will be added
     *pelem : element to add
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_add_pos(lcrzo_list *plist,
		       lcrzo_int32 position,
		       const void *pelem);
/* Name : lcrzo_list_add_first
   Description :
     Add an element to the first position of a lcrzo_list.
   Input parameter(s) :
     *pelem : element to add
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_add_first(lcrzo_list *plist,
			 const void *pelem);
/* Name : lcrzo_list_add_last
   Description :
     Add an element to the last position of a lcrzo_list.
   Input parameter(s) :
     *pelem : element to add
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_add_last(lcrzo_list *plist,
			const void *pelem);
/*-------------------------------------------------------------*/
/* Name : lcrzo_list_remove_pos
   Description :
     Remove an element from the lcrzo_list.
   Input parameter(s) :
     position : position of the removed element
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_remove_pos(lcrzo_list *plist,
			  lcrzo_int32 position);
/* Name : lcrzo_list_remove_first
   Description :
     Remove the first element from the lcrzo_list.
   Input parameter(s) :
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_remove_first(lcrzo_list *plist);
/* Name : lcrzo_list_remove_last
   Description :
     Remove the last element from the lcrzo_list.
   Input parameter(s) :
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_remove_last(lcrzo_list *plist);
/* Name : lcrzo_list_remove_range
   Description :
     Remove a range of elements from the lcrzo_list.
   Input parameter(s) :
     startpos : position of the first element
     endpos : position of the last element
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_remove_range(lcrzo_list *plist,
			    lcrzo_int32 startpos,
			    lcrzo_int32 endpos);
/* Name : lcrzo_list_remove_all
   Description :
     Remove all the elements from the lcrzo_list.
   Input parameter(s) :
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_remove_all(lcrzo_list *plist);
/* Name : lcrzo_list_remove_duplicate_range
   Description :
     Remove duplicate elements from a range of the lcrzo_list.
   Input parameter(s) :
     startpos : position of the first element
     endpos : position of the last element
     pfunc_compare : memory address of the function which will
                     be called for each element in the range
                     [startpos->endpos]. This function compares
		     *peleminf and *pelemsup :
                      - if eleminf<elemsup, returns -1
                      - if eleminf>elemsup, returns +1
                      - if eleminf==elemsup, returns 0
		     For each call, the third parameter ('pinfos')
		     will be set with the optional parameter below.
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
     pinfos : optional parameter (can be NULL) which will be
              used as the second parameter for *pfunc_compare.
	      This may be used to send information to *pfunc_compare.
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_remove_duplicate_range(lcrzo_list *plist,
				      lcrzo_int32 startpos,
				      lcrzo_int32 endpos,
				      lcrzo_int8 (*pfunc_compare)(const void*peleminf,
							   const void*pelemsup,
							   void *pinfos),
				      void *pinfos);
/* Name : lcrzo_list_remove_duplicate_all
   Description :
     Remove duplicate elements of the lcrzo_list.
   Input parameter(s) :
     pfunc_compare : memory address of the function which will
                     be called for each element.
		     This function compares
		     *peleminf and *pelemsup :
                      - if eleminf<elemsup, returns -1
                      - if eleminf>elemsup, returns +1
                      - if eleminf==elemsup, returns 0
		     For each call, the third parameter ('pinfos')
		     will be set with the optional parameter below.
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
     pinfos : optional parameter (can be NULL) which will be
              used as the second parameter for *pfunc_compare.
	      This may be used to send information to *pfunc_compare.
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_remove_duplicate_all(lcrzo_list *plist,
				    lcrzo_int8 (*pfunc_compare)(const void *peleminf,
							 const void *pelemsup,
							 void *pinfos),
				    void *pinfos);
/* Name : lcrzo_list_remove_criteria_range
   Description :
     Remove elements matching a criteria, and in a range of the lcrzo_list.
   Input parameter(s) :
     startpos : position of the first element
     endpos : position of the last element
     pfunc_criteria : memory address of the function which will
                      be called for each element in the range
                      [startpos->endpos]. This function checks
		      *pelem :
		       - if *pelem must be removed, returns 1
		       - else returns 0
  		      For each call, the second parameter ('pinfos')
		      will be set with the optional parameter below.
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
     pinfos : optional parameter (can be NULL) which will be
              used as the second parameter for *pfunc_criteria.
	      This may be used to send information to *pfunc_criteria.
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_remove_criteria_range(lcrzo_list *plist,
				     lcrzo_int32 startpos,
				     lcrzo_int32 endpos,
				     lcrzo_bool (*pfunc_criteria)(const void *pelem,
							          void *pinfos),
				     void *pinfos);
/* Name : lcrzo_list_remove_criteria_all
   Description :
     Remove elements matching a criteria.
   Input parameter(s) :
     pfunc_criteria : memory address of the function which will
                      be called for each element. This function checks
		      *pelem :
		       - if *pelem must be removed, returns 1
		       - else returns 0
  		      For each call, the second parameter ('pinfos')
		      will be set with the optional parameter below.
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
     pinfos : optional parameter (can be NULL) which will be
              used as the second parameter for *pfunc_criteria.
	      This may be used to send information to *pfunc_criteria.
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_remove_criteria_all(lcrzo_list *plist,
				   lcrzo_bool (*pfunc_criteria)(const void *pelem,
							 void *pinfos),
				   void *pinfos);
/*-------------------------------------------------------------*/
/* Name : lcrzo_list_replace_pos
   Description :
     Replace an element in the lcrzo_list.
   Input parameter(s) :
     position : position of the replaced element
     *pelem : element which will be put in position
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_replace_pos(lcrzo_list *plist,
			   lcrzo_int32 position,
			   const void *pelem);
/* Name : lcrzo_list_replace_first
   Description :
     Replace the first element in the lcrzo_list.
   Input parameter(s) :
     *pelem : element which will be put in first place
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_replace_first(lcrzo_list *plist,
			     const void *pelem);
/* Name : lcrzo_list_replace_last
   Description :
     Replace the last element in the lcrzo_list.
   Input parameter(s) :
     *pelem : element which will be put in first place
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_replace_last(lcrzo_list *plist,
			    const void *pelem);
/*-------------------------------------------------------------*/
/* Name : lcrzo_list_switch
   Description :
     Switch two elements in the lcrzo_list.
   Input parameter(s) :
     position1 : position of the first element
     position2 : position of the second element
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_switch(lcrzo_list *plist,
		      lcrzo_int32 position1,
		      lcrzo_int32 position2);
/*-------------------------------------------------------------*/
/* Name : lcrzo_list_invert_range
   Description :
     Invert the positions of elements in a given range
   Input parameter(s) :
     startpos : position of the first element
     endpos : position of the last element
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_invert_range(lcrzo_list *plist,
			    lcrzo_int32 startpos,
			    lcrzo_int32 endpos);
/* Name : lcrzo_list_invert_all
   Description :
     Invert the positions of elements
   Input parameter(s) :
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_invert_all(lcrzo_list *plist);
/*-------------------------------------------------------------*/
/* Name : lcrzo_list_value_pos
   Description :
     Get the value of an element
   Input parameter(s) :
     *plist : lcrzo_list where to work
     position : position of the wanted element
   Input/output parameter(s) :
   Output parameter(s) :
     *pelem : receives a copy of the element
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_value_pos(lcrzo_list *plist,
			 lcrzo_int32 position,
			 void *pelem);
/* Name : lcrzo_list_value_first
   Description :
     Get the value of the first element
   Input parameter(s) :
     *plist : lcrzo_list where to work
   Input/output parameter(s) :
   Output parameter(s) :
     *pelem : receives a copy of the element
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_value_first(lcrzo_list *plist,
			   void *pelem);
/* Name : lcrzo_list_value_last
   Description :
     Get the value of the last element
   Input parameter(s) :
     *plist : lcrzo_list where to work
   Input/output parameter(s) :
   Output parameter(s) :
     *pelem : receives a copy of the element
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_value_last(lcrzo_list *plist,
			  void *pelem);
/*-------------------------------------------------------------*/
/* Name : lcrzo_list_count
   Description :
     Count the number of elements
   Input parameter(s) :
     *plist : lcrzo_list where to work
   Input/output parameter(s) :
   Output parameter(s) :
     *pnumberofelem : number of elements in list
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_count(lcrzo_list *plist,
		     lcrzo_int32 *pnumberofelem);
/*-------------------------------------------------------------*/
/* Name : lcrzo_list_sort_range
   Description :
     Sort elements from a range of the lcrzo_list.
   Input parameter(s) :
     startpos : position of the first element
     endpos : position of the last element
     pfunc_compare : memory address of the function which will
                     be called for each element in the range
                     [startpos->endpos]. This function compares
                     *peleminf and *pelemsup :
                      - if eleminf<elemsup, returns -1
                      - if eleminf>elemsup, returns +1
                      - if eleminf==elemsup, returns 0
                     For each call, the third parameter ('pinfos')
                     will be set with the optional parameter below.
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
     pinfos : optional parameter (can be NULL) which will be
              used as the second parameter for *pfunc_compare.
              This may be used to send information to *pfunc_compare.
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_sort_range(lcrzo_list *plist,
			  lcrzo_int32 startpos,
			  lcrzo_int32 endpos,
			  lcrzo_int8 (*pfunc_compare)(const void *peleminf,
					       const void *pelemsup,
					       void *pinfos),
			  void *pinfos);
/* Name : lcrzo_list_sort_all
   Description :
     Sort elements of the lcrzo_list.
   Input parameter(s) :
     pfunc_compare : memory address of the function which will
                     be called for each element. This function compares
                     *peleminf and *pelemsup :
                      - if eleminf<elemsup, returns -1
                      - if eleminf>elemsup, returns +1
                      - if eleminf==elemsup, returns 0
                     For each call, the third parameter ('pinfos')
                     will be set with the optional parameter below.
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
     pinfos : optional parameter (can be NULL) which will be
              used as the second parameter for *pfunc_compare.
              This may be used to send information to *pfunc_compare.
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_sort_all(lcrzo_list *plist,
			lcrzo_int8 (*pfunc_compare)(const void *peleminf,
					     const void *pelemsup,
					     void *pinfos),
			void *pinfos);
/*-------------------------------------------------------------*/
/* Name : lcrzo_list_search_range
   Description :
     Search elements matching a criteria, and in a range of the lcrzo_list.
   Input parameter(s) :
     *plist : lcrzo_list where to work
     startpos : position of the first element
     endpos : position of the last element
     pfunc_search : memory address of the function which will
                    be called for each element in the range
                    [startpos->endpos]. This function checks
                    *pelem :
                     - if *pelem is like we want, returns 1
		     - else returns 0
		    For each call, the second parameter ('pinfos')
		    will be set with the optional parameter below.
   Input/output parameter(s) :
     pinfos : optional parameter (can be NULL) which will be
              used as the second parameter for *pfunc_search.
              This may be used to send information to *pfunc_search.
   Output parameter(s) :
     *pposelem : position of the found element
     *pelem : copy of the found elem
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_search_range(lcrzo_list *plist,
			    lcrzo_int32 startpos,
			    lcrzo_int32 endpos,
			    lcrzo_bool (*pfunc_search)(const void *pelem,
						void *pinfos),
			    void *pinfos,
			    lcrzo_int32 *pposelem,
			    void *pelem);
/* Name : lcrzo_list_search_all
   Description :
     Search elements matching a criteria.
   Input parameter(s) :
     *plist : lcrzo_list where to work
     pfunc_search : memory address of the function which will
                    be called for each element. This function checks
                    *pelem :
                     - if *pelem is like we want, returns 1
		     - else returns 0
		    For each call, the second parameter ('pinfos')
		    will be set with the optional parameter below.
   Input/output parameter(s) :
     pinfos : optional parameter (can be NULL) which will be
              used as the second parameter for *pfunc_search.
              This may be used to send information to *pfunc_search.
   Output parameter(s) :
     *pposelem : position of the found element
     *pelem : copy of the found elem
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_search_all(lcrzo_list *plist,
			  lcrzo_bool (*pfunc_search)(const void *pelem,
					      void *pinfos),
			  void *pinfos,
			  lcrzo_int32 *pposelem,
			  void *pelem);
/*-------------------------------------------------------------*/
/* Name : lcrzo_list_searchelem_range
   Description :
     Search elements in a range of the lcrzo_list.
     Data has to be entirely stored in list elements (no
     pointer in pelem).
   Input parameter(s) :
     *plist : lcrzo_list where to work
     startpos : position of the first element
     endpos : position of the last element
     pelemtofind : address of the elem to find (its sizeof is
                   compared)
   Input/output parameter(s) :
   Output parameter(s) :
     *pposelemfound : position of the found element
     *pelemfound : copy of the found elem
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_searchelem_range(lcrzo_list *plist,
				lcrzo_int32 startpos,
				lcrzo_int32 endpos,
				const void *pelemtofind,
				lcrzo_int32 *pposelemfound,
				void *pelemfound);
/* Name : lcrzo_list_searchelem_all
   Description :
     Search elements.
     Data has to be entirely stored in list elements (no
     pointer in pelem).
   Input parameter(s) :
     *plist : lcrzo_list where to work
     pelemtofind : address of the elem to find (its sizeof
                   is compared)
   Input/output parameter(s) :
   Output parameter(s) :
     *pposelemfound : position of the found element
     *pelemfound : copy of the found elem
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_searchelem_all(lcrzo_list *plist,
			      const void *pelemtofind,
			      lcrzo_int32 *pposelemfound,
			      void *pelemfound);
/*-------------------------------------------------------------*/
/* Name : lcrzo_list_loop_range
   Description :
     Call a function for each element in a
     given position range.
   Input parameter(s) :
     startpos : start position for the loop (cf. the above frame to
                know possible values)
     endpos : end position for the loop (cf. the above frame to
              know possible values)
     pfunc : memory address of the function which will be called
             for each element in the range [startpos->endpos]. For
             each call, the first parameter ('pelem') will be set
             with the element, and the second parameter ('pinfos')
             will be set with the optional parameter below.
   Input/output parameter(s) :
     pinfos : optional parameter (can be NULL) which will be
              used as the second parameter for *pfunc. This may be
              used to send information to *pfunc.
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_loop_range(lcrzo_list *plist,
			  lcrzo_int32 startpos,
			  lcrzo_int32 endpos,
			  int (*pfunc)(const void *pelem,
				       void *pinfos),
			  void *pinfos);
/* Name : lcrzo_list_loop_all
   Description :
     Call a function for each element.
   Input parameter(s) :
     pfunc : memory address of the function which will be called
             for each element. For
             each call, the first parameter ('pelem') will be set
             with the element, and the second parameter ('pinfos')
             will be set with the optional parameter below.
   Input/output parameter(s) :
     pinfos : optional parameter (can be NULL) which will be
              used as the second parameter for *pfunc. This may be
              used to send information to *pfunc.
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_list_loop_all(lcrzo_list *plist,
			int (*pfunc)(const void *pelem,
				     void *pinfos),
			void *pinfos);
/*-------------------------------------------------------------*/
/***************************************************************
 * Note about lcrzo_datalist_xxx :                             *
 * The following four functions allow to put variable sized     *
 * data in a lcrzo_list. They supersedes :                     *
 *   lcrzo_list_init                                           *
 *   lcrzo_list_add_pos                                        *
 *   lcrzo_list_value_pos                                      *
 ***************************************************************/
/*-------------------------------------------------------------*/
/* this dynamic structure will be stored in the list */
typedef struct {
  lcrzo_uint32 datatype;
  lcrzo_uint32 datasize;
  lcrzo_data   pdata; /* pointer to data */
} lcrzo_datalist;
/*-------------------------------------------------------------*/
/* Name : lcrzo_datalist_init
   Description :
     Initialize a lcrzo_list.
   Input parameter(s) :
   Input/output parameter(s) :
   Output parameter(s) :
     *plist : lcrzo_list initialized
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_datalist_init(lcrzo_list *plist);
/* Name : lcrzo_datalist_add_pos
   Description :
     Add an element to the lcrzo_list.
   Input parameter(s) :
     pos : position where the element will be added
     datatype : type of data (allows you to put several data
                types in the same list). You can use the value
		you want
     data : data to put in the list
     datasize : size of data
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_datalist_add_pos(lcrzo_list *plist,
			   lcrzo_int32 pos,
			   lcrzo_uint32 datatype,
			   lcrzo_constdata data,
			   lcrzo_int32 datasize);
/* Name : lcrzo_datalist_valuem_pos
   Description :
     Get the value of an element
   Input parameter(s) :
     *plist : lcrzo_list where to work
     pos : position of the wanted element
   Input/output parameter(s) :
   Output parameter(s) :
     *pdatatype : type of this data
     *pdata : pointer which will be malloced (so, the
              memory will have to be freed by the
              user with 'free(*pdata)').
	      The allocated memory will be set with the element
     *pdatasize : reached size of data
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_datalist_valuem_pos(lcrzo_list *plist,
			      lcrzo_int32 pos,
			      lcrzo_uint32 *pdatatype,
			      lcrzo_data *pdata,
			      lcrzo_int32 *pdatasize);
/*-------------------------------------------------------------*/
/* idem, but the list contains strings */
typedef struct {
  lcrzo_uint32 stringtype;
  lcrzo_string pstring; /* pointer to str*/
} lcrzo_stringlist;
int lcrzo_stringlist_init(lcrzo_list *plist);
int lcrzo_stringlist_add_pos(lcrzo_list *plist,
			     lcrzo_int32 pos,
			     lcrzo_uint32 stringtype,
			     lcrzo_conststring string);
int lcrzo_stringlist_valuem_pos(lcrzo_list *plist,
				lcrzo_int32 pos,
				lcrzo_uint32 *pstringtype,
				lcrzo_string *pstring);
/*-------------------------------------------------------------*/
typedef struct {
  lcrzo_uint16 inf;
  lcrzo_uint16 sup;
} lcrzo_portlist;
/* Name : lcrzo_portlist_init
   Description :
     Initialize a lcrzo_list containing lcrzo_portlist elements.
   Input parameter(s) :
   Input/output parameter(s) :
   Output parameter(s) :
     *plist : lcrzo_list initialized
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_portlist_init(lcrzo_list *plist);
/* Name : lcrzo_portlist_add_range
   Description :
     Add a range of ports to the lcrzo_list.
   Input parameter(s) :
     infport : inferior port
     support : superior port
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_portlist_add_range(lcrzo_list *plist,
			     lcrzo_uint16 infport,
			     lcrzo_uint16 support);
/* Name : lcrzo_portlist_del_range
   Description :
     Remove a range of ports to the lcrzo_list.
   Input parameter(s) :
     infport : inferior port
     support : superior port
   Input/output parameter(s) :
     *plist : lcrzo_list where to work
   Output parameter(s) :
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_portlist_del_range(lcrzo_list *plist,
			     lcrzo_uint16 infport,
			     lcrzo_uint16 support);
/* Name : lcrzo_portlist_init_text
   Description :
     Initialize a lcrzo_list containing lcrzo_portlist elements.
   Input parameter(s) :
     porttext : a string like :
                  "21-25"
                  "21-25,56,78-100"
		  "all,!21,!23,!100-200"
   Input/output parameter(s) :
   Output parameter(s) :
     *plist : lcrzo_list initialized
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_portlist_init_text(lcrzo_conststring porttext,
			     lcrzo_list *plist);
/* Name : lcrzo_string_initm_portlist
   Description :
     Initialize a string with a port list.
   Input parameter(s) :
   Input/output parameter(s) :
     *plist : lcrzo_list containing the list of ports
   Output parameter(s) :
     *pporttext : string initialized. For example "21-25,56,78-100"
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_string_initm_portlist(lcrzo_list *plist,
				lcrzo_string *pporttext);
/* Name : lcrzo_portlist_isinlist
   Description :
     Check if a port is in the port list.
   Input parameter(s) :
     port : port to find
   Input/output parameter(s) :
     *plist : lcrzo_list containing the list of ports
   Output parameter(s) :
     *pyes : true if port is found
   Normal return values :
     LCRZO_ERR_OK : ok
*/
int lcrzo_portlist_isinlist(lcrzo_list *plist,
			    lcrzo_uint16 port,
			    lcrzo_bool *pyes);
/* Name : lcrzo_portlist_value_first
   Description :
     Get the first port in the port list.
   Input parameter(s) :
   Input/output parameter(s) :
     *plist : lcrzo_list containing the list of ports
   Output parameter(s) :
     *pport : first port
   Normal return values :
     LCRZO_ERR_OK : ok
     LCRZO_ERR_OKDATAEND : no port in the list
*/
int lcrzo_portlist_value_first(lcrzo_list *plist,
			       lcrzo_uint16 *pport);
/* Name : lcrzo_portlist_value_next
   Description :
     Get the next port in the port list.
   Input parameter(s) :
     port : port
   Input/output parameter(s) :
     *plist : lcrzo_list containing the list of ports
   Output parameter(s) :
     *pnextport : port following port
   Normal return values :
     LCRZO_ERR_OK : ok
     LCRZO_ERR_OKDATAEND : end of the list reached
*/
int lcrzo_portlist_value_next(lcrzo_list *plist,
			      lcrzo_uint16 port,
			      lcrzo_uint16 *pnextport);
int lcrzo_portlist_init_stdin(lcrzo_conststring message,
			      lcrzo_conststring defaultlist,
			      lcrzo_list *plist);
/*-------------------------------------------------------------*/
/* idem with IP addresses */
typedef struct {
  lcrzo_ipl inf;
  lcrzo_ipl sup;
} lcrzo_iplist;
int lcrzo_iplist_init(lcrzo_list *plist);
int lcrzo_iplist_add_range(lcrzo_list *plist,
			   lcrzo_ipl infipl,
			   lcrzo_ipl supipl);
int lcrzo_iplist_del_range(lcrzo_list *plist,
			   lcrzo_ipl infipl,
			   lcrzo_ipl supipl);
int lcrzo_iplist_init_text(lcrzo_conststring ipltext,
			   lcrzo_list *plist);
int lcrzo_string_initm_iplist(lcrzo_list *plist,
			      lcrzo_string *pipltext);
int lcrzo_iplist_isinlist(lcrzo_list *plist,
			  lcrzo_ipl ipl,
			  lcrzo_bool *pyes);
int lcrzo_iplist_value_first(lcrzo_list *plist,
			     lcrzo_ipl *pipl);
int lcrzo_iplist_value_next(lcrzo_list *plist,
			    lcrzo_ipl ipl,
			    lcrzo_ipl *pnextipl);
int lcrzo_iplist_init_stdin(lcrzo_conststring message,
			    lcrzo_conststring defaultlist,
			    lcrzo_list *plist);
/*-------------------------------------------------------------*/
/* idem with Ethernet addresses */
typedef struct {
  lcrzo_etha inf;
  lcrzo_etha sup;
} lcrzo_ethlist;
int lcrzo_ethlist_init(lcrzo_list *plist);
int lcrzo_ethlist_add_range(lcrzo_list *plist,
			    lcrzo_etha infetha,
			    lcrzo_etha supetha);
int lcrzo_ethlist_del_range(lcrzo_list *plist,
			    lcrzo_etha infetha,
			    lcrzo_etha supetha);
int lcrzo_ethlist_init_text(lcrzo_conststring textethlist,
			    lcrzo_list *plist);
int lcrzo_string_initm_ethlist(lcrzo_list *plist,
			       lcrzo_string *ptextethlist);
int lcrzo_ethlist_isinlist(lcrzo_list *plist,
			   lcrzo_etha etha,
			   lcrzo_bool *pyes);
int lcrzo_ethlist_value_first(lcrzo_list *plist,
			      lcrzo_etha etha);
int lcrzo_ethlist_value_next(lcrzo_list *plist,
			     lcrzo_etha etha,
			     lcrzo_etha nextetha);
int lcrzo_ethlist_init_stdin(lcrzo_conststring message,
			     lcrzo_conststring defaultlist,
			     lcrzo_list *plist);

SEE ALSO
lcrzo(3), lcrzo_types(3), lcrzo_data(3), lcrzo_string(3), lcrzo_time(3), lcrzo_file(3), lcrzo_address(3), lcrzo_device(3), lcrzo_list(3), lcrzo_process(3), lcrzo_ipc(3), lcrzo_header(3), lcrzo_ipopt(3), lcrzo_tcpopt(3), lcrzo_packet(3), lcrzo_icmp(3), lcrzo_print(3), lcrzo_record(3), lcrzo_conf(3), lcrzo_spoof(3), lcrzo_sniff(3), lcrzo_sock(3), lcrzo_wait(3), lcrzo_global(3), lcrzo_error(3) lcrzo_misc(3), lcrzo_obso(3),