Main Page | Data Structures | Directories | File List | Data Fields | Globals

mrss.h File Reference

#include <sys/types.h>

Include dependency graph for mrss.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  mrss_item_t
 Struct data for item elements. More...
struct  mrss_hour_t
 Struct data for skipHours elements. More...
struct  mrss_day_t
 Struct data for skipDays elements. More...
struct  mrss_category_t
 Struct data for category elements. More...
struct  mrss_t
 Principal data struct. It contains pointers to any other structures. More...

Typedefs

typedef mrss_t mrss_t
typedef mrss_item_t mrss_item_t
typedef mrss_category_t mrss_category_t
typedef mrss_hour_t mrss_hour_t
typedef mrss_day_t mrss_day_t
typedef void * mrss_generic_t

Enumerations

enum  mrss_error_t {
  MRSS_OK = 0, MRSS_ERR_POSIX, MRSS_ERR_PARSER, MRSS_ERR_VERSION,
  MRSS_ERR_DATA
}
enum  mrss_version_t { MRSS_VERSION_0_91, MRSS_VERSION_0_92, MRSS_VERSION_2_0 }
enum  mrss_flag_t {
  MRSS_FLAG_VERSION = 1, MRSS_FLAG_TITLE, MRSS_FLAG_DESCRIPTION, MRSS_FLAG_LINK,
  MRSS_FLAG_LANGUAGE, MRSS_FLAG_RATING, MRSS_FLAG_COPYRIGHT, MRSS_FLAG_PUBDATE,
  MRSS_FLAG_LASTBUILDDATE, MRSS_FLAG_DOCS, MRSS_FLAG_MANAGINGEDITOR, MRSS_FLAG_WEBMASTER,
  MRSS_FLAG_GENERATOR, MRSS_FLAG_TTL, MRSS_FLAG_IMAGE_TITLE, MRSS_FLAG_IMAGE_URL,
  MRSS_FLAG_IMAGE_LINK, MRSS_FLAG_IMAGE_WIDTH, MRSS_FLAG_IMAGE_HEIGHT, MRSS_FLAG_IMAGE_DESCRIPTION,
  MRSS_FLAG_TEXTINPUT_TITLE, MRSS_FLAG_TEXTINPUT_DESCRIPTION, MRSS_FLAG_TEXTINPUT_NAME, MRSS_FLAG_TEXTINPUT_LINK,
  MRSS_FLAG_CLOUD, MRSS_FLAG_CLOUD_DOMAIN, MRSS_FLAG_CLOUD_PORT, MRSS_FLAG_CLOUD_PATH,
  MRSS_FLAG_CLOUD_REGISTERPROCEDURE, MRSS_FLAG_CLOUD_PROTOCOL, MRSS_FLAG_HOUR, MRSS_FLAG_DAY,
  MRSS_FLAG_CATEGORY, MRSS_FLAG_CATEGORY_DOMAIN, MRSS_FLAG_ITEM_TITLE, MRSS_FLAG_ITEM_LINK,
  MRSS_FLAG_ITEM_DESCRIPTION, MRSS_FLAG_ITEM_AUTHOR, MRSS_FLAG_ITEM_COMMENTS, MRSS_FLAG_ITEM_PUBDATE,
  MRSS_FLAG_ITEM_GUID, MRSS_FLAG_ITEM_GUID_ISPERMALINK, MRSS_FLAG_ITEM_SOURCE, MRSS_FLAG_ITEM_SOURCE_URL,
  MRSS_FLAG_ITEM_ENCLOSURE, MRSS_FLAG_ITEM_ENCLOSURE_URL, MRSS_FLAG_ITEM_ENCLOSURE_LENGTH, MRSS_FLAG_ITEM_ENCLOSURE_TYPE,
  MRSS_FLAG_END = 0
}
enum  mrss_element_t {
  MRSS_ELEMENT_CHANNEL, MRSS_ELEMENT_ITEM, MRSS_ELEMENT_SKIPHOURS, MRSS_ELEMENT_SKIPDAYS,
  MRSS_ELEMENT_CATEGORY
}

Functions

mrss_error_t mrss_parse_url (char *url, mrss_t **mrss)
mrss_error_t mrss_parse_file (char *file, mrss_t **mrss)
mrss_error_t mrss_parse_buffer (char *buffer, size_t size_buffer, mrss_t **mrss)
mrss_error_t mrss_write_file (mrss_t *mrss, char *file)
mrss_error_t mrss_write_buffer (mrss_t *mrss, char **buffer)
mrss_error_t mrss_free (mrss_generic_t element)
char * mrss_strerror (mrss_error_t err)
mrss_error_t mrss_element (mrss_generic_t element, mrss_element_t *ret)
mrss_error_t mrss_new (mrss_t **mrss)
mrss_error_t mrss_set (mrss_generic_t element,...)
mrss_error_t mrss_get (mrss_generic_t element,...)
mrss_error_t mrss_new_subdata (mrss_generic_t element, mrss_element_t subelement, mrss_generic_t subdata)
mrss_error_t mrss_remove_subdata (mrss_generic_t element, mrss_generic_t subdata)


Typedef Documentation

typedef struct mrss_category_t mrss_category_t
 

Definition at line 26 of file mrss.h.

typedef struct mrss_day_t mrss_day_t
 

Definition at line 28 of file mrss.h.

typedef void* mrss_generic_t
 

Definition at line 29 of file mrss.h.

typedef struct mrss_hour_t mrss_hour_t
 

Definition at line 27 of file mrss.h.

typedef struct mrss_item_t mrss_item_t
 

Definition at line 25 of file mrss.h.

typedef struct mrss_t mrss_t
 

Definition at line 24 of file mrss.h.


Enumeration Type Documentation

enum mrss_element_t
 

Enum for the casting of the libmrss data struct

Enumerator:
MRSS_ELEMENT_CHANNEL  The data struct is a mrss_t
MRSS_ELEMENT_ITEM  The data struct is a mrss_item_t
MRSS_ELEMENT_SKIPHOURS  The data struct is a mrss_hour_t
MRSS_ELEMENT_SKIPDAYS  The data struct is a mrss_day_t
MRSS_ELEMENT_CATEGORY  The data struct is a mrss_category_t

Definition at line 178 of file mrss.h.

enum mrss_error_t
 

This enum describes the error type of libmrss

Enumerator:
MRSS_OK  No error
MRSS_ERR_POSIX  For the correct error, use errno
MRSS_ERR_PARSER  Parser error
MRSS_ERR_VERSION  The RSS has a no compatible VERSION
MRSS_ERR_DATA  The parameters are incorrect

Definition at line 32 of file mrss.h.

00032              {
00033   MRSS_OK = 0,                  
00034   MRSS_ERR_POSIX,               
00035   MRSS_ERR_PARSER,              
00036   MRSS_ERR_VERSION,             
00037   MRSS_ERR_DATA                 
00038 } mrss_error_t;

enum mrss_flag_t
 

Flag list for mrss_set and mrss_get functions

Enumerator:
MRSS_FLAG_VERSION  Set the ersion to a mrss_t element - the value is a mrss_version_t enum
MRSS_FLAG_TITLE  Set the title to a mrss_t element - the value is a string
MRSS_FLAG_DESCRIPTION  Set the description to a mrss_t element - the value is a string
MRSS_FLAG_LINK  Set the link to a mrss_t element - the value is a string
MRSS_FLAG_LANGUAGE  Set the language to a mrss_t element - the value is a string
MRSS_FLAG_RATING  Set the rating to a mrss_t element - the value is a string
MRSS_FLAG_COPYRIGHT  Set the copyright to a mrss_t element - the value is a string
MRSS_FLAG_PUBDATE  Set the pubDate to a mrss_t element - the value is a string
MRSS_FLAG_LASTBUILDDATE  Set the lastBuildDate to a mrss_t element - the value is a string
MRSS_FLAG_DOCS  Set the docs to a mrss_t element - the value is a string
MRSS_FLAG_MANAGINGEDITOR  Set the managingeditor to a mrss_t element - the value is a string
MRSS_FLAG_WEBMASTER  Set the webMaster to a mrss_t element - the value is a string
MRSS_FLAG_GENERATOR  Set the generator to a mrss_t element - the value is a string
MRSS_FLAG_TTL  Set the ttl to a mrss_t element - the value is a integer
MRSS_FLAG_IMAGE_TITLE  Set the image_title to a mrss_t element - the value is a string
MRSS_FLAG_IMAGE_URL  Set the image_url to a mrss_t element - the value is a string
MRSS_FLAG_IMAGE_LINK  Set the image_link to a mrss_t element - the value is a string
MRSS_FLAG_IMAGE_WIDTH  Set the image_width to a mrss_t element - the value is a integer
MRSS_FLAG_IMAGE_HEIGHT  Set the image_height to a mrss_t element - the value is a integer
MRSS_FLAG_IMAGE_DESCRIPTION  Set the image_description to a mrss_t element - the value is a string
MRSS_FLAG_TEXTINPUT_TITLE  Set the textinput_title to a mrss_t element - the value is a string
MRSS_FLAG_TEXTINPUT_DESCRIPTION  Set the textinput_description to a mrss_t element - the value is a string
MRSS_FLAG_TEXTINPUT_NAME  Set the textinput_name to a mrss_t element - the value is a string
MRSS_FLAG_TEXTINPUT_LINK  Set the textinput_link to a mrss_t element - the value is a string
MRSS_FLAG_CLOUD  Set the cloud to a mrss_t element - the value is a string
MRSS_FLAG_CLOUD_DOMAIN  Set the cloud_domain to a mrss_t element - the value is a string
MRSS_FLAG_CLOUD_PORT  Set the cloud_port to a mrss_t element - the value is a string
MRSS_FLAG_CLOUD_PATH  Set the cloud_path to a mrss_t element - the value is a integer
MRSS_FLAG_CLOUD_REGISTERPROCEDURE  Set the cloud_registerProcedure to a mrss_t element - the value is a string
MRSS_FLAG_CLOUD_PROTOCOL  Set the cloud_protocol to a mrss_t element - the value is a string
MRSS_FLAG_HOUR  Set the hour to a mrss_hour_t element - the value is a string
MRSS_FLAG_DAY  Set the day to a mrss_day_t element - the value is a string
MRSS_FLAG_CATEGORY  Set the category to a mrss_category_t element - the value is a string
MRSS_FLAG_CATEGORY_DOMAIN  Set the domain to a mrss_category_t element - the value is a string
MRSS_FLAG_ITEM_TITLE  Set the title to a mrss_item_t element - the value is a string
MRSS_FLAG_ITEM_LINK  Set the link to a mrss_item_t element - the value is a string
MRSS_FLAG_ITEM_DESCRIPTION  Set the description to a mrss_item_t element - the value is a string
MRSS_FLAG_ITEM_AUTHOR  Set the author to a mrss_item_t element - the value is a string
MRSS_FLAG_ITEM_COMMENTS  Set the comments to a mrss_item_t element - the value is a string
MRSS_FLAG_ITEM_PUBDATE  Set the pubDate to a mrss_item_t element - the value is a string
MRSS_FLAG_ITEM_GUID  Set the guid to a mrss_item_t element - the value is a string
MRSS_FLAG_ITEM_GUID_ISPERMALINK  Set the guid_isPermaLink to a mrss_item_t element - the value is a integer
MRSS_FLAG_ITEM_SOURCE  Set the source to a mrss_item_t element - the value is a string
MRSS_FLAG_ITEM_SOURCE_URL  Set the source_url to a mrss_item_t element - the value is a string
MRSS_FLAG_ITEM_ENCLOSURE  Set the enclosure to a mrss_item_t element - the value is a string
MRSS_FLAG_ITEM_ENCLOSURE_URL  Set the enclosure_url to a mrss_item_t element - the value is a string
MRSS_FLAG_ITEM_ENCLOSURE_LENGTH  Set the enclosure_length to a mrss_item_t element - the value is a integer
MRSS_FLAG_ITEM_ENCLOSURE_TYPE  Set the enclosure_type to a mrss_item_t element - the value is a string
MRSS_FLAG_END  Set the terminetor flag

Definition at line 47 of file mrss.h.

00047              {
00048   /* Generic */
00049 
00051   MRSS_FLAG_VERSION = 1,
00052 
00054   MRSS_FLAG_TITLE,
00056   MRSS_FLAG_DESCRIPTION,
00058   MRSS_FLAG_LINK,
00060   MRSS_FLAG_LANGUAGE,
00062   MRSS_FLAG_RATING,
00064   MRSS_FLAG_COPYRIGHT,
00066   MRSS_FLAG_PUBDATE,
00068   MRSS_FLAG_LASTBUILDDATE,
00070   MRSS_FLAG_DOCS,
00072   MRSS_FLAG_MANAGINGEDITOR,
00074   MRSS_FLAG_WEBMASTER,
00076   MRSS_FLAG_GENERATOR,
00078   MRSS_FLAG_TTL,
00079 
00080   /* Image */
00081 
00083   MRSS_FLAG_IMAGE_TITLE,
00085   MRSS_FLAG_IMAGE_URL,
00087   MRSS_FLAG_IMAGE_LINK,
00089   MRSS_FLAG_IMAGE_WIDTH,
00091   MRSS_FLAG_IMAGE_HEIGHT,
00093   MRSS_FLAG_IMAGE_DESCRIPTION,
00094 
00095   /* TextInput */
00096 
00098   MRSS_FLAG_TEXTINPUT_TITLE,
00100   MRSS_FLAG_TEXTINPUT_DESCRIPTION,
00102   MRSS_FLAG_TEXTINPUT_NAME,
00104   MRSS_FLAG_TEXTINPUT_LINK,
00105 
00106   /* Cloud */
00107 
00109   MRSS_FLAG_CLOUD,
00111   MRSS_FLAG_CLOUD_DOMAIN,
00113   MRSS_FLAG_CLOUD_PORT,
00115   MRSS_FLAG_CLOUD_PATH,
00118   MRSS_FLAG_CLOUD_REGISTERPROCEDURE,
00120   MRSS_FLAG_CLOUD_PROTOCOL,
00121 
00122   /* SkipHours */
00123 
00125   MRSS_FLAG_HOUR,
00126 
00127   /* SkipDays */
00128 
00130   MRSS_FLAG_DAY,
00131 
00132   /* Category or Item/Category */
00133 
00135   MRSS_FLAG_CATEGORY,
00137   MRSS_FLAG_CATEGORY_DOMAIN,
00138 
00139   /* Item */
00140 
00142   MRSS_FLAG_ITEM_TITLE,
00144   MRSS_FLAG_ITEM_LINK,
00146   MRSS_FLAG_ITEM_DESCRIPTION,
00148   MRSS_FLAG_ITEM_AUTHOR,
00150   MRSS_FLAG_ITEM_COMMENTS,
00152   MRSS_FLAG_ITEM_PUBDATE,
00154   MRSS_FLAG_ITEM_GUID,
00157   MRSS_FLAG_ITEM_GUID_ISPERMALINK,
00159   MRSS_FLAG_ITEM_SOURCE,
00161   MRSS_FLAG_ITEM_SOURCE_URL,
00163   MRSS_FLAG_ITEM_ENCLOSURE,
00165   MRSS_FLAG_ITEM_ENCLOSURE_URL,
00168   MRSS_FLAG_ITEM_ENCLOSURE_LENGTH,
00170   MRSS_FLAG_ITEM_ENCLOSURE_TYPE,
00171 
00173   MRSS_FLAG_END = 0
00174 
00175 } mrss_flag_t;

enum mrss_version_t
 

Enumerator:
MRSS_VERSION_0_91  0.91 RSS version
MRSS_VERSION_0_92  0.92 RSS version
MRSS_VERSION_2_0  2.0 RSS version

Definition at line 40 of file mrss.h.


Function Documentation

mrss_error_t mrss_element mrss_generic_t  element,
mrss_element_t ret
 

This functions returns the mrss_element_t of a mrss data struct.

Parameters:
element it is the element that you want check
ret it is a pointer to a mrss_element_t. It will be sets.
Returns:
the error code

Definition at line 51 of file mrss_generic.c.

References mrss_t::element, MRSS_ERR_DATA, and MRSS_OK.

00052 {
00053   mrss_t *tmp;
00054 
00055   if (!element || !ret)
00056     return MRSS_ERR_DATA;
00057 
00058   tmp=(mrss_t *)element;
00059   *ret = tmp->element;
00060   return MRSS_OK;
00061 }

mrss_error_t mrss_free mrss_generic_t  element  ) 
 

This function frees any type of data struct of libmrss.

 mrss_t *t=....;
 mrss_item_t *item=...;

 mrss_free(t);
 mrss_free(item);

Parameters:
element the data struct
Returns:
the error code

Definition at line 259 of file mrss_free.c.

References __mrss_free_category(), __mrss_free_channel(), __mrss_free_day(), __mrss_free_hour(), __mrss_free_item(), mrss_t::element, MRSS_ELEMENT_CATEGORY, MRSS_ELEMENT_CHANNEL, MRSS_ELEMENT_ITEM, MRSS_ELEMENT_SKIPDAYS, MRSS_ELEMENT_SKIPHOURS, MRSS_ERR_DATA, and MRSS_OK.

Referenced by __mrss_parser_rss().

00260 {
00261   mrss_t *tmp;
00262 
00263   tmp = (mrss_t *) element;
00264 
00265   switch (tmp->element)
00266     {
00267     case MRSS_ELEMENT_CHANNEL:
00268       __mrss_free_channel ((mrss_t *) element);
00269       break;
00270 
00271     case MRSS_ELEMENT_ITEM:
00272       __mrss_free_item ((mrss_item_t *) element);
00273       break;
00274 
00275     case MRSS_ELEMENT_SKIPHOURS:
00276       __mrss_free_hour ((mrss_hour_t *) element);
00277       break;
00278 
00279     case MRSS_ELEMENT_SKIPDAYS:
00280       __mrss_free_day ((mrss_day_t *) element);
00281       break;
00282 
00283     case MRSS_ELEMENT_CATEGORY:
00284       __mrss_free_category ((mrss_category_t *) element);
00285       break;
00286 
00287     default:
00288       return MRSS_ERR_DATA;
00289     }
00290 
00291   return MRSS_OK;
00292 }

Here is the call graph for this function:

mrss_error_t mrss_get mrss_generic_t  element,
  ...
 

This function returns the request arguments. The syntax is the same of mrss_set but the values of the list are pointer to data element (int *, char **). If the key needs a char **, the value will be allocated.

 mrss_get(category, MRSS_FLAG_CATEGORY_DOMAIN, &string, MRSS_FLAG_END);
 if(string) free(string);
Parameters:
element it is any type of mrss data struct.
Returns:
the error code

Definition at line 423 of file mrss_edit.c.

References __mrss_get_category(), __mrss_get_channel(), __mrss_get_day(), __mrss_get_hour(), __mrss_get_item(), mrss_t::element, MRSS_ELEMENT_CATEGORY, MRSS_ELEMENT_CHANNEL, MRSS_ELEMENT_ITEM, MRSS_ELEMENT_SKIPDAYS, MRSS_ELEMENT_SKIPHOURS, and MRSS_ERR_DATA.

00424 {
00425   va_list va;
00426   mrss_error_t err;
00427   mrss_t *tmp;
00428 
00429   if (!data)
00430     return MRSS_ERR_DATA;
00431 
00432   va_start (va, data);
00433 
00434   tmp = (mrss_t *) data;
00435   switch (tmp->element)
00436     {
00437     case MRSS_ELEMENT_CHANNEL:
00438       err = __mrss_get_channel ((mrss_t *) data, va);
00439       break;
00440 
00441     case MRSS_ELEMENT_ITEM:
00442       err = __mrss_get_item ((mrss_item_t *) data, va);
00443       break;
00444 
00445     case MRSS_ELEMENT_SKIPHOURS:
00446       err = __mrss_get_hour ((mrss_hour_t *) data, va);
00447       break;
00448 
00449     case MRSS_ELEMENT_SKIPDAYS:
00450       err = __mrss_get_day ((mrss_day_t *) data, va);
00451       break;
00452 
00453     case MRSS_ELEMENT_CATEGORY:
00454       err = __mrss_get_category ((mrss_category_t *) data, va);
00455       break;
00456 
00457     default:
00458       err = MRSS_ERR_DATA;
00459       break;
00460     }
00461 
00462   va_end (va);
00463   return err;
00464 }

Here is the call graph for this function:

mrss_error_t mrss_new mrss_t **  mrss  ) 
 

If you want create a new feed RSS from scratch, you need use this function as the first.

 mrss_t *d;
 mrss_error_t err;
 char *string;
 int integer;

 d=NULL; // ->this is important!
 mrss_new(&d);

 err=mrss_set (d,
                 MRSS_FLAG_VERSION, MRSS_VERSION_0_92,
                 MRSS_FLAG_TITLE, "the title!",
                 MRSS_FLAG_TTL, 12,
                 MRSS_FLAG_END);

 if(err!=MRSS_OK) printf("%s\n",mrss_strerror(err));

 err=mrss_get (d,
                 MRSS_FLAG_TITLE, &string,
                 MRSS_FLAG_TTL, &integer,
                 MRSS_FLAG_END);

 if(err!=MRSS_OK) printf("%s\n",mrss_strerror(err));
 printf("The title is: '%s'\n", string);
 printf("The ttl is: '%d'\n", integer);
 free(string);

Parameters:
mrss is the pointer to the new data struct
Returns:
the error code

Definition at line 67 of file mrss_edit.c.

References MRSS_ELEMENT_CHANNEL, MRSS_ERR_DATA, MRSS_ERR_POSIX, and MRSS_OK.

00068 {
00069   if (!data)
00070     return MRSS_ERR_DATA;
00071 
00072   if (!*data && !(*data = (mrss_t *) malloc (sizeof (mrss_t))))
00073     return MRSS_ERR_POSIX;
00074 
00075   memset (*data, 0, sizeof (mrss_t));
00076   (*data)->element = MRSS_ELEMENT_CHANNEL;
00077 
00078   return MRSS_OK;
00079 }

mrss_error_t mrss_new_subdata mrss_generic_t  element,
mrss_element_t  subelement,
mrss_generic_t  subdata
 

This function adds an element to another element. For example you can add a item to a channel, or a category to a item, and so on. Look this example:

  mrss_item_t *item = NULL;
 mrss_hour_t *hour = NULL;
 mrss_day_t day;              // If the element is no null, the function
 mrss_category_t category,    // does not alloc it

 mrss_new_subdata(mrss, MRSS_ELEMENT_ITEM, &item);
 mrss_new_subdata(mrss, MRSS_ELEMENT_SKIPHOURS, &hour);
 mrss_new_subdata(mrss, MRSS_ELEMENT_SKIPDAYS, &day);
 mrss_new_subdata(item, MRSS_ELEMENT_ITEM_CATEGORY, &category);
Parameters:
element it is the parent element
subelement it is the type of the child (MRSS_ELEMENT_ITEM, MRSS_ELEMENT_CATEGORY, ...)
subdata it is the pointer to the new struct. If the pointer of *subdata exists, it will no alloced, else yes.
Returns:
the error code
See also:
mrss_element_t

Definition at line 768 of file mrss_edit.c.

References __mrss_new_subdata_channel(), __mrss_new_subdata_item(), mrss_t::element, MRSS_ELEMENT_CHANNEL, MRSS_ELEMENT_ITEM, and MRSS_ERR_DATA.

00770 {
00771   mrss_t *tmp;
00772 
00773   if (!data || !new)
00774     return MRSS_ERR_DATA;
00775 
00776   tmp = (mrss_t *) data;
00777 
00778   switch (tmp->element)
00779     {
00780     case MRSS_ELEMENT_CHANNEL:
00781       return __mrss_new_subdata_channel ((mrss_t *) data, element, new);
00782     case MRSS_ELEMENT_ITEM:
00783       return __mrss_new_subdata_item ((mrss_item_t *) data, element, new);
00784     default:
00785       return MRSS_ERR_DATA;
00786     }
00787 }

Here is the call graph for this function:

mrss_error_t mrss_parse_buffer char *  buffer,
size_t  size_buffer,
mrss_t **  mrss
 

Parses a buffer and creates the data struct of the feed RSS url

Parameters:
buffer Pointer to the xml memory stream to be parsed
size_buffer The size of the array of char
mrss the pointer to your data struct
Returns:
the error code

Definition at line 751 of file mrss_parser.c.

References __mrss_parser(), MRSS_ERR_DATA, and MRSS_ERR_PARSER.

00752 {
00753   xmlDocPtr doc;
00754   mrss_error_t err;
00755 
00756   if (!buffer || !size || !ret)
00757     return MRSS_ERR_DATA;
00758 
00759   if (!(doc = xmlParseMemory (buffer, size)))
00760     return MRSS_ERR_PARSER;
00761 
00762   if (!(err = __mrss_parser (doc, ret)))
00763     (*ret)->size = size;
00764 
00765   return err;
00766 }

Here is the call graph for this function:

mrss_error_t mrss_parse_file char *  file,
mrss_t **  mrss
 

Parses a file and creates the data struct of the feed RSS url

Parameters:
file The file to be parsed
mrss the pointer to your data struct
Returns:
the error code

Definition at line 721 of file mrss_parser.c.

References __mrss_parser(), MRSS_ERR_DATA, MRSS_ERR_PARSER, and MRSS_ERR_POSIX.

00722 {
00723   xmlDocPtr doc;
00724   mrss_error_t err;
00725   struct stat st;
00726 
00727   if (!file || !ret)
00728     return MRSS_ERR_DATA;
00729 
00730   if (lstat (file, &st))
00731     return MRSS_ERR_POSIX;
00732 
00733   if (!(doc = xmlParseFile (file)))
00734     return MRSS_ERR_PARSER;
00735 
00736   if (!(err = __mrss_parser (doc, ret)))
00737     {
00738       if (!((*ret)->file = strdup (file)))
00739         {
00740           *ret = NULL;
00741           return MRSS_ERR_POSIX;
00742         }
00743 
00744       (*ret)->size = st.st_size;
00745     }
00746 
00747   return err;
00748 }

Here is the call graph for this function:

mrss_error_t mrss_parse_url char *  url,
mrss_t **  mrss
 

Parses a url and creates the data struct of the feed RSS url. This function downloads your request if this is http or ftp.

Parameters:
url The url to be parsed
mrss the pointer to your data struct
Returns:
the error code

Definition at line 684 of file mrss_parser.c.

References __mrss_download_file(), __mrss_parser(), __mrss_download_t__::mm, MRSS_ERR_DATA, MRSS_ERR_PARSER, MRSS_ERR_POSIX, and __mrss_download_t__::size.

00685 {
00686   __mrss_download_t *download;
00687   xmlDocPtr doc;
00688   mrss_error_t err;
00689 
00690   if (!url || !ret)
00691     return MRSS_ERR_DATA;
00692 
00693   if (!(download = __mrss_download_file (url)))
00694     return MRSS_ERR_POSIX;
00695 
00696   if (!(doc = xmlParseMemory (download->mm, download->size)))
00697     {
00698       free (download->mm);
00699       free (download);
00700       return MRSS_ERR_PARSER;
00701     }
00702 
00703   if (!(err = __mrss_parser (doc, ret)))
00704     {
00705       if (!((*ret)->file = strdup (url)))
00706         {
00707           *ret = NULL;
00708           return MRSS_ERR_POSIX;
00709         }
00710 
00711       (*ret)->size = download->size;
00712     }
00713 
00714   free (download->mm);
00715   free (download);
00716 
00717   return err;
00718 }

Here is the call graph for this function:

mrss_error_t mrss_remove_subdata mrss_generic_t  element,
mrss_generic_t  subdata
 

This function remove a subdata element. As first argoment you must specify the parent, and second argoment the child.

 mrss_remove_subdata(mrss, item);
Parameters:
element it is the parent
subdata the child that you want remove. Remember: mrss_remove_subdata does not free the memory. So you can remove a item and reinsert it after.
Returns:
the error code

Definition at line 897 of file mrss_edit.c.

References __mrss_remove_subdata_channel(), __mrss_remove_subdata_item(), mrss_t::element, MRSS_ELEMENT_CHANNEL, MRSS_ELEMENT_ITEM, and MRSS_ERR_DATA.

00898 {
00899   mrss_t *tmp;
00900 
00901   if (!data || !subdata)
00902     return MRSS_ERR_DATA;
00903 
00904   tmp = (mrss_t *) data;
00905 
00906   switch (tmp->element)
00907     {
00908     case MRSS_ELEMENT_CHANNEL:
00909       return __mrss_remove_subdata_channel ((mrss_t *) data, subdata);
00910     case MRSS_ELEMENT_ITEM:
00911       return __mrss_remove_subdata_item ((mrss_item_t *) data, subdata);
00912     default:
00913       return MRSS_ERR_DATA;
00914     }
00915 }

Here is the call graph for this function:

mrss_error_t mrss_set mrss_generic_t  element,
  ...
 

For insert/replace/remove a flags use this function as this example:

Parameters:
element it is the mrss data that you want changes the the next list of elements. The list is composted by KEY - VALUES and as last element MRSS_FLAG_END. The variable of value depends from key.
See also:
mrss_flag_t
Returns:
the error code

Definition at line 82 of file mrss_edit.c.

References __mrss_set_category(), __mrss_set_channel(), __mrss_set_day(), __mrss_set_hour(), __mrss_set_item(), mrss_t::element, MRSS_ELEMENT_CATEGORY, MRSS_ELEMENT_CHANNEL, MRSS_ELEMENT_ITEM, MRSS_ELEMENT_SKIPDAYS, MRSS_ELEMENT_SKIPHOURS, and MRSS_ERR_DATA.

00083 {
00084   va_list va;
00085   mrss_error_t err;
00086   mrss_t *tmp;
00087 
00088   if (!data)
00089     return MRSS_ERR_DATA;
00090 
00091   va_start (va, data);
00092 
00093   tmp = (mrss_t *) data;
00094   switch (tmp->element)
00095     {
00096     case MRSS_ELEMENT_CHANNEL:
00097       err = __mrss_set_channel ((mrss_t *) data, va);
00098       break;
00099 
00100     case MRSS_ELEMENT_ITEM:
00101       err = __mrss_set_item ((mrss_item_t *) data, va);
00102       break;
00103 
00104     case MRSS_ELEMENT_SKIPHOURS:
00105       err = __mrss_set_hour ((mrss_hour_t *) data, va);
00106       break;
00107 
00108     case MRSS_ELEMENT_SKIPDAYS:
00109       err = __mrss_set_day ((mrss_day_t *) data, va);
00110       break;
00111 
00112     case MRSS_ELEMENT_CATEGORY:
00113       err = __mrss_set_category ((mrss_category_t *) data, va);
00114       break;
00115 
00116     default:
00117       err = MRSS_ERR_DATA;
00118       break;
00119     }
00120 
00121   va_end (va);
00122   return err;
00123 }

Here is the call graph for this function:

char* mrss_strerror mrss_error_t  err  ) 
 

This function returns a static string with the description of error code

Parameters:
err the error code that you need as string
Returns:
a string. Don't free this string!

Definition at line 29 of file mrss_generic.c.

References MRSS_ERR_DATA, MRSS_ERR_PARSER, MRSS_ERR_VERSION, and MRSS_OK.

00030 {
00031   switch (err)
00032     {
00033     case MRSS_OK:
00034       return "Success";
00035 
00036     case MRSS_ERR_PARSER:
00037       return "Parser error";
00038 
00039     case MRSS_ERR_VERSION:
00040       return "Version error";
00041 
00042     case MRSS_ERR_DATA:
00043       return "No correct paramenter in the function";
00044 
00045     default:
00046       return strerror (errno);
00047     }
00048 }

mrss_error_t mrss_write_buffer mrss_t mrss,
char **  buffer
 

Write a RSS struct data in a buffer.

 char *buffer;
 buffer=NULL; //<--- This is important!!
 mrss_write_buffer (mrss, &buffer);

The buffer must be NULL.

Parameters:
mrss the rss struct data
buffer the buffer
Returns:
the error code

Definition at line 625 of file mrss_write.c.

References __mrss_buffer_write(), __mrss_write_real(), and MRSS_ERR_DATA.

00626 {
00627   if (!mrss || !buffer)
00628     return MRSS_ERR_DATA;
00629 
00630   return __mrss_write_real (mrss, __mrss_buffer_write, buffer);
00631 }

Here is the call graph for this function:

mrss_error_t mrss_write_file mrss_t mrss,
char *  file
 

Writes a RSS struct data in a local file

Parameters:
mrss the rss struct data
file the local file
Returns:
the error code

Definition at line 607 of file mrss_write.c.

References __mrss_file_write(), __mrss_write_real(), MRSS_ERR_DATA, and MRSS_ERR_POSIX.

00608 {
00609   FILE *fl;
00610   mrss_error_t ret;
00611 
00612   if (!mrss || !file)
00613     return MRSS_ERR_DATA;
00614 
00615   if (!(fl = fopen (file, "wb")))
00616     return MRSS_ERR_POSIX;
00617 
00618   ret = __mrss_write_real (mrss, __mrss_file_write, fl);
00619   fclose (fl);
00620 
00621   return ret;
00622 }

Here is the call graph for this function:


Generated on Thu Jul 28 12:15:06 2005 for libmrss by  doxygen 1.4.3-20050530