3 #include "generic_utils.h"
6 #include <libxml/globals.h>
7 #include <libxml/xmlerror.h>
8 #include <libxml/parser.h>
9 #include <libxml/tree.h>
10 #include <libxml/debugXML.h>
11 #include <libxml/xmlmemory.h>
17 #ifndef TRANSPORT_MESSAGE_H
18 #define TRANSPORT_MESSAGE_H
22 // ---------------------------------------------------------------------------------
23 // Jabber message object.
24 // ---------------------------------------------------------------------------------
25 struct transport_message_struct {
39 char* msg_xml; /* the entire message as XML complete with entity encoding */
41 typedef struct transport_message_struct transport_message;
43 // ---------------------------------------------------------------------------------
44 // Allocates and returns a transport_message. All chars are safely re-allocated
45 // within this method.
46 // Returns NULL on error
47 // ---------------------------------------------------------------------------------
48 transport_message* message_init( char* body, char* subject,
49 char* thread, char* recipient, char* sender );
52 void message_set_router_info( transport_message* msg, char* router_from,
53 char* router_to, char* router_class, char* router_command, int broadcast_enabled );
55 // ---------------------------------------------------------------------------------
56 // Formats the Jabber message as XML for encoding.
57 // Returns NULL on error
58 // ---------------------------------------------------------------------------------
59 char* message_to_xml( const transport_message* msg );
62 // ---------------------------------------------------------------------------------
63 // Call this to create the encoded XML for sending on the wire.
64 // This is a seperate function so that encoding will not necessarily have
65 // to happen on all messages (i.e. typically only occurs outbound messages).
66 // ---------------------------------------------------------------------------------
67 int message_prepare_xml( transport_message* msg );
69 // ---------------------------------------------------------------------------------
70 // Deallocates the memory used by the transport_message
72 // ---------------------------------------------------------------------------------
73 int message_free( transport_message* msg );
75 // ---------------------------------------------------------------------------------
76 // Prepares the shared XML document
77 // ---------------------------------------------------------------------------------
78 //int message_init_xml();
80 // ---------------------------------------------------------------------------------
81 // Determines the username of a Jabber ID. This expects a pre-allocated char
82 // array for the return value.
83 // ---------------------------------------------------------------------------------
84 void jid_get_username( const char* jid, char buf[] );
86 // ---------------------------------------------------------------------------------
87 // Determines the resource of a Jabber ID. This expects a pre-allocated char
88 // array for the return value.
89 // ---------------------------------------------------------------------------------
90 void jid_get_resource( const char* jid, char buf[] );
92 void set_msg_error( transport_message*, char* error_type, int error_code);