createrepo_c library 1.2.1 C library for metadata manipulation

Data Structures | Macros | Enumerations | Functions
XML dump API.

Example: More...

## Data Structures
struct | cr_XmlStruct

## Macros
#define | CR_XML_COMMON_NS "http://linux.duke.edu/metadata/common"
#define | CR_XML_FILELISTS_NS "http://linux.duke.edu/metadata/filelists"
#define | CR_XML_FILELISTS_EXT_NS "http://linux.duke.edu/metadata/filelists-ext"
#define | CR_XML_OTHER_NS "http://linux.duke.edu/metadata/other"
#define | CR_XML_REPOMD_NS "http://linux.duke.edu/metadata/repo"
#define | CR_XML_RPM_NS "http://linux.duke.edu/metadata/rpm"

## Enumerations
enum | cr_dump_parameter { CR_XML_DUMP_DO_PRETTY_PRINT, CR_XML_DUMP_OPTION_COUNT, CR_XML_DUMP_OPTION_MAX = 1024 }

## Functions
void | cr_xml_dump_init ()
void | cr_xml_dump_set_parameter (cr_dump_parameter param, int value)
int | cr_xml_dump_get_parameter (cr_dump_parameter param)
void | cr_xml_dump_cleanup ()
char * | cr_xml_dump_primary (cr_Package *package, GError **err)
char * | cr_xml_dump_filelists (cr_Package *package, GError **err)
char * | cr_xml_dump_filelists_ext (cr_Package *package, GError **err)
char * | cr_xml_dump_other (cr_Package *package, GError **err)
struct cr_XmlStruct | cr_xml_dump (cr_Package *package, GError **err)
struct cr_XmlStruct | cr_xml_dump_ext (cr_Package *package, GError **err)
char * | cr_xml_dump_repomd (cr_Repomd *repomd, GError **err)
char * | cr_xml_dump_updateinfo (cr_UpdateInfo *updateinfo, GError **err)
char * | cr_xml_dump_updaterecord (cr_UpdateRecord *rec, GError **err)
char * | cr_xml_dump_deltapackage (cr_DeltaPackage *dpkg, GError **err)
void | cr_latin1_to_utf8 (const unsigned char *in, unsigned char *out) __attribute__((hot))
gboolean | cr_hascontrollchars (const unsigned char *str)
gchar * | cr_prepend_protocol (const gchar *url)
gboolean | cr_Package_contains_forbidden_control_chars (cr_Package *pkg)
gboolean | cr_GSList_of_cr_Dependency_contains_forbidden_control_chars (GSList *deps)

## Detailed Description

Example:

cr_Package *pkg;
struct cr_XmlStruct xml;
cr_xml_dump_init();
cr_package_parser_init();
pkg = cr_package_from_rpm_base("path/to/rpm.rpm", 5, CR_HDRR_NONE, NULL);
xml = cr_xml_dump(pkg, NULL);
cr_package_free(pkg);
printf("Primary XML chunk:\n%s\n", xml.primary);
printf("Filelists XML chunk:\n%s\n", xml.filelists);
printf("Other XML chunk:\n%s\n", xml.other);
free(xml.primary);
free(xml.filelists);
free(xml.other);
cr_package_parser_cleanup();
cr_xml_dump_cleanup();

## Macro Definition Documentation

## ◆ CR_XML_COMMON_NS

#define CR_XML_COMMON_NS "http://linux.duke.edu/metadata/common"

Default namespace for primary.xml

Definition at line 66 of file xml_dump.h.

## ◆ CR_XML_FILELISTS_EXT_NS

#define CR_XML_FILELISTS_EXT_NS "http://linux.duke.edu/metadata/filelists-ext"

Default namespace for filelists-ext.xml

Definition at line 70 of file xml_dump.h.

## ◆ CR_XML_FILELISTS_NS

#define CR_XML_FILELISTS_NS "http://linux.duke.edu/metadata/filelists"

Default namespace for filelists.xml

Definition at line 68 of file xml_dump.h.

## ◆ CR_XML_OTHER_NS

#define CR_XML_OTHER_NS "http://linux.duke.edu/metadata/other"

Default namespace for other.xml

Definition at line 72 of file xml_dump.h.

## ◆ CR_XML_REPOMD_NS

#define CR_XML_REPOMD_NS "http://linux.duke.edu/metadata/repo"

Default namespace for repomd.xml

Definition at line 74 of file xml_dump.h.

## ◆ CR_XML_RPM_NS

#define CR_XML_RPM_NS "http://linux.duke.edu/metadata/rpm"

Namespace for rpm (used in primary.xml and repomd.xml)

Definition at line 76 of file xml_dump.h.

## Enumeration Type Documentation

## ◆ cr_dump_parameter

enum cr_dump_parameter

Xml dump options

Definition at line 90 of file xml_dump.h.

## Function Documentation

## ◆ cr_GSList_of_cr_Dependency_contains_forbidden_control_chars()

gboolean cr_GSList_of_cr_Dependency_contains_forbidden_control_chars | ( | GSList * | deps | ) |

Check if list of cr_Dependency stucts contains any strings with chars with value <32 (except 9, 10 and 13), using cr_hascontrollchars

Parameters

  deps | the GSList of cr_Dependencies in question

Returns
  boolean value

## ◆ cr_hascontrollchars()

gboolean cr_hascontrollchars | ( | const unsigned char * | str | ) |

Check if string contains chars with value <32 (except 9, 10 and 13).

Parameters

  str | String (NOT NULL!!!!)

Returns
  TRUE if at leas one char with value <32 (except the 9, 10, 13) is present in the string.

## ◆ cr_latin1_to_utf8()

void cr_latin1_to_utf8 | ( | const unsigned char * | in,
|  | unsigned char * | out
| ) |  |

Prepare string to xml dump. If string is not utf8 it is converted (source encoding is supposed to be iso-8859-1). Control chars (chars with value <32 except 9, 10 and 13) are excluded.

Parameters

  in | input string.
  out | output string. space of output string must be at least (strlen(in) * 2 + 1) * sizeof(char)

## ◆ cr_Package_contains_forbidden_control_chars()

gboolean cr_Package_contains_forbidden_control_chars | ( | cr_Package * | pkg | ) |

Check if package contains any strings with chars with value <32 (except 9, 10 and 13), using cr_hascontrollchars

Parameters

  pkg | the cr_Package in question

Returns
  boolean value

## ◆ cr_prepend_protocol()

gchar* cr_prepend_protocol | ( | const gchar * | url | ) |

Prepend protocol if necessary

Parameters

  url | input url

Returns
  output string, must be freed

## ◆ cr_xml_dump()

struct cr_XmlStruct cr_xml_dump | ( | cr_Package * | package,
|  | GError ** | err
| ) |  |

Generate all three xml chunks (primary, filelists, other) from cr_Package.

Parameters

  package | cr_Package
  err | **GError

Returns
  cr_XmlStruct

## ◆ cr_xml_dump_cleanup()

void cr_xml_dump_cleanup | ( |  | ) |

Cleanup initialized dumping part of library

## ◆ cr_xml_dump_deltapackage()

char* cr_xml_dump_deltapackage | ( | cr_DeltaPackage * | dpkg,
|  | GError ** | err
| ) |  |

Generate xml representation of cr_DeltaPackage

Parameters

  dpkg | cr_DeltaPackage
  err | **GError

Returns
  xml chunk string or NULL on error

## ◆ cr_xml_dump_ext()

struct cr_XmlStruct cr_xml_dump_ext | ( | cr_Package * | package,
|  | GError ** | err
| ) |  |

Generate all four xml chunks (primary, filelists[_ext], other) from cr_Package.

Parameters

  package | cr_Package
  err | **GError

Returns
  cr_XmlStruct

## ◆ cr_xml_dump_filelists()

char* cr_xml_dump_filelists | ( | cr_Package * | package,
|  | GError ** | err
| ) |  |

Generate filelists xml chunk from cr_Package.

Parameters

  package | cr_Package
  err | **GError

Returns
  xml chunk string or NULL on error

## ◆ cr_xml_dump_filelists_ext()

char* cr_xml_dump_filelists_ext | ( | cr_Package * | package,
|  | GError ** | err
| ) |  |

Generate filelists-ext xml chunk from cr_Package.

Parameters

  package | cr_Package
  err | **GError

Returns
  xml chunk string or NULL on error

## ◆ cr_xml_dump_get_parameter()

int cr_xml_dump_get_parameter | ( | cr_dump_parameter | param | ) |

Get the value of one xml dump parameter.

## ◆ cr_xml_dump_init()

void cr_xml_dump_init | ( |  | ) |

Initialize dumping part of library. Call only once from the main thread.

Initializes libxml2.

## ◆ cr_xml_dump_other()

char* cr_xml_dump_other | ( | cr_Package * | package,
|  | GError ** | err
| ) |  |

Generate other xml chunk from cr_Package.

Parameters

  package | cr_Package
  err | **GError

Returns
  xml chunk string or NULL on error

## ◆ cr_xml_dump_primary()

char* cr_xml_dump_primary | ( | cr_Package * | package,
|  | GError ** | err
| ) |  |

Generate primary xml chunk from cr_Package.

Parameters

  package | cr_Package
  err | **GError

Returns
  xml chunk string or NULL on error

## ◆ cr_xml_dump_repomd()

char* cr_xml_dump_repomd | ( | cr_Repomd * | repomd,
|  | GError ** | err
| ) |  |

Generate xml representation of cr_Repomd.

Parameters

  repomd | cr_Repomd
  err | **GError

Returns
  repomd.xml content

## ◆ cr_xml_dump_set_parameter()

void cr_xml_dump_set_parameter | ( | cr_dump_parameter | param,
|  | int | value
| ) |  |

Set one xml dump parameter.

## ◆ cr_xml_dump_updateinfo()

char* cr_xml_dump_updateinfo | ( | cr_UpdateInfo * | updateinfo,
|  | GError ** | err
| ) |  |

Generate xml representation of cr_UpdateInfo.

Parameters

  updateinfo | cr_UpdateInfo
  err | **GError

Returns
  repomd.xml content

## ◆ cr_xml_dump_updaterecord()

char* cr_xml_dump_updaterecord | ( | cr_UpdateRecord * | rec,
|  | GError ** | err
| ) |  |

Generate xml representation of cr_UpdateRecord

Parameters

  rec | cr_UpdateRecord
  err | **GError

Returns
  xml chunk string or NULL on error

cr_package_free
void cr_package_free(cr_Package *package)
cr_package_parser_init
void cr_package_parser_init()
cr_package_from_rpm_base
cr_Package * cr_package_from_rpm_base(const char *filename, int changelog_limit, cr_HeaderReadingFlags flags, GError **err)
cr_xml_dump_init
void cr_xml_dump_init()
cr_package_parser_cleanup
void cr_package_parser_cleanup()
cr_xml_dump
struct cr_XmlStruct cr_xml_dump(cr_Package *package, GError **err)
cr_xml_dump_cleanup
void cr_xml_dump_cleanup()
cr_Package
Definition: package.h:84
cr_XmlStruct
Definition: xml_dump.h:81