#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.
|
|
|
|
|
|
|
|
|
|
|
|
|
Enum for the casting of the libmrss data struct
Definition at line 178 of file mrss.h. 00178 { 00180 MRSS_ELEMENT_CHANNEL, 00182 MRSS_ELEMENT_ITEM, 00184 MRSS_ELEMENT_SKIPHOURS, 00186 MRSS_ELEMENT_SKIPDAYS, 00188 MRSS_ELEMENT_CATEGORY 00189 } mrss_element_t;
|
|
This enum describes the error type of libmrss
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;
|
|
Flag list for mrss_set and mrss_get functions
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;
|
|
Definition at line 40 of file mrss.h. 00040 { 00041 MRSS_VERSION_0_91, 00042 MRSS_VERSION_0_92, 00043 MRSS_VERSION_2_0 00044 } mrss_version_t;
|
|
This functions returns the mrss_element_t of a mrss data struct.
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 }
|
|
This function frees any type of data struct of libmrss.
mrss_t *t=....; mrss_item_t *item=...; mrss_free(t); mrss_free(item);
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: ![]() |
|
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);
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: ![]() |
|
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);
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 }
|
|
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);
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: ![]() |
|
Parses a buffer and creates the data struct of the feed RSS url
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: ![]() |
|
Parses a file and creates the data struct of the feed RSS url
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: ![]() |
|
Parses a url and creates the data struct of the feed RSS url. This function downloads your request if this is http or ftp.
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: ![]() |
|
This function remove a subdata element. As first argoment you must specify the parent, and second argoment the child. mrss_remove_subdata(mrss, item);
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: ![]() |
|
For insert/replace/remove a flags use this function as this example: mrss_set(mrss, MRSS_FLAG_TITLE, "hello world", MRSS_FLAG_END); mrss_set(item, MRSS_FLAG_DESCRIPTION, NULL, MRSS_FLAG_END);
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: ![]() |
|
This function returns a static string with the description of error code
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 }
|
|
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.
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: ![]() |
|
Writes a RSS struct data in a local file
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: ![]() |