1
0
Fork 0
mirror of git://git.psyc.eu/libpsyc synced 2024-08-15 03:19:02 +00:00

more documentation

This commit is contained in:
Marenz 2011-05-09 02:07:13 +02:00
parent 211c0bcefb
commit 5c20b9a875

View file

@ -10,6 +10,15 @@
* @defgroup parser Parsing Functions * @defgroup parser Parsing Functions
* *
* This module contains packet and list parsing functions. * This module contains packet and list parsing functions.
* The parser adheres to the definition of a packet found at
*
* http://about.psyc.eu/Spec:Packet
*
* and the according terms are used throughout this documentation and in the
* return codes. You should be at least
* vaguely familiar with what the difference between "body" and "content" as
* well as "routing variable" and "entity variable" is.
*
* *
* To parse a packet you first have to initialize a state: * To parse a packet you first have to initialize a state:
* *
@ -77,7 +86,7 @@
* case PSYC_PARSE_BODY: // it is the method and the body of the packet. * case PSYC_PARSE_BODY: // it is the method and the body of the packet.
* printf("Method Name: %.*s Body: %.*s\n", * printf("Method Name: %.*s Body: %.*s\n",
* name.length, name.ptr, // name of the method * name.length, name.ptr, // name of the method
* value.length, value.ptr); // valeu of the body * value.length, value.ptr); // value of the body
* break; * break;
* case PSYC_PARSE_COMPLETE: // parsing of this packet is complete * case PSYC_PARSE_COMPLETE: // parsing of this packet is complete
* // You can simply continue parsing till you get the * // You can simply continue parsing till you get the
@ -110,7 +119,7 @@ typedef enum
{ {
/// Parse only the header /// Parse only the header
PSYC_PARSE_ROUTING_ONLY = 1, PSYC_PARSE_ROUTING_ONLY = 1,
/// Parse only the content. This means that there is no header and parsing will fail if there is one. The beginning of the content is expected. /// Parse only the content. Parsing starts at the content and the content must be complete. "content" means the definition used in the packet specification.
PSYC_PARSE_START_AT_CONTENT = 2, PSYC_PARSE_START_AT_CONTENT = 2,
} psycParseFlag; } psycParseFlag;