#ifndef _SmsXml_Header
#define _SmsXml_Header
#include "smslib.h"

struct sms_xml;
typedef struct sms_xml SmsXml;

struct xml_message;
typedef struct xml_message XmlMessage;

typedef struct xml_init {
	int placeholder;
} XmlInit;

SmsXml *sms_xml_init(Sms *sms, XmlInit *init, int *errcode);
void sms_xml_free(SmsXml **xml);

XmlMessage *sms_xml_wait(SmsXml *xml, long timeout_msec, int *errcode);

int sms_xml_send(SmsXml *xml, void *data, char *from, char *to, char *message);
int sms_xml_recv(SmsXml *xml, XmlMessage *msg);
int sms_xml_accept(SmsXml *xml, XmlMessage *msg, int code, char *reason);
int sms_xml_reject(SmsXml *xml, XmlMessage *msg, int code, char *reason);

char *sms_xml_error(SmsXml *xml, int errcode, char *bf, int bfsz);

char *sms_xml_fromip(SmsXml *xml, XmlMessage *msg);
char *sms_xml_from(SmsXml *xml, XmlMessage *msg);
char *sms_xml_to(SmsXml *xml, XmlMessage *msg);
char *sms_xml_body(SmsXml *xml, XmlMessage *msg);

void sms_xml_msgfree(SmsXml *xml, XmlMessage **msg);

void sms_xml_lock(void (*lockfn)(int));
void sms_xml_unlock(void (*unlockfn)(int));

#endif
