00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _LIBJABBER_TYPES_H_
00024 #define _LIBJABBER_TYPES_H_ 1
00025
00026
00027
00028
00029
00030 #define JID_RESOURCE 1
00031 #define JID_USER 2
00032 #define JID_SERVER 4
00033
00034 typedef struct jid_struct {
00035 xode_pool p;
00036 char *resource;
00037 char *user;
00038 char *server;
00039 char *full;
00040 struct jid_struct *next;
00041 } *jid;
00042
00043
00044
00045
00046
00047
00048
00049 #define JABPACKET_UNKNOWN 0
00050 #define JABPACKET_MESSAGE 1
00051 #define JABPACKET_PRESENCE 2
00052 #define JABPACKET_IQ 3
00053
00054 #define JABPACKET__UNKNOWN 0
00055 #define JABPACKET__NONE 1
00056 #define JABPACKET__ERROR 2
00057 #define JABPACKET__CHAT 3
00058 #define JABPACKET__GROUPCHAT 4
00059 #define JABPACKET__GET 5
00060 #define JABPACKET__SET 6
00061 #define JABPACKET__RESULT 7
00062 #define JABPACKET__SUBSCRIBE 8
00063 #define JABPACKET__SUBSCRIBED 9
00064 #define JABPACKET__UNSUBSCRIBE 10
00065 #define JABPACKET__UNSUBSCRIBED 11
00066 #define JABPACKET__AVAILABLE 12
00067 #define JABPACKET__UNAVAILABLE 13
00068 #define JABPACKET__PROBE 14
00069 #define JABPACKET__HEADLINE 15
00070 #define JABPACKET__INVISIBLE 16
00071 #define JABPACKET__INTERNAL 17
00072
00073 typedef struct jabpacket_struct {
00074 int type;
00075 int subtype;
00076 int flag;
00077 void *aux1;
00078 xode x;
00079 jid to;
00080 jid from;
00081 char *iqns;
00082 xode iq;
00083 xode_pool p;
00084 } *jabpacket, _jabpacket;
00085
00086
00087
00088
00089
00090
00091
00092 #define JABCONN_STATE_OFF 0
00093 #define JABCONN_STATE_CONNECTED 1
00094 #define JABCONN_STATE_ON 2
00095 #define JABCONN_STATE_AUTH 3
00096
00097 typedef struct jabconn_struct {
00098
00099 xode_pool p;
00100 int state;
00101 int fd;
00102 int dumpfd;
00103 char *dumpid;
00104 #ifdef USE_SSL
00105 int sslfd;
00106 SSL *ssl;
00107 SSL_CTX *ssl_ctx;
00108 #endif
00109 jid user;
00110 char *pass;
00111 int port;
00112
00113
00114 int auth_password;
00115 int auth_digest;
00116 int auth_0k;
00117
00118
00119 int id;
00120 char idbuf[9];
00121 char *sid;
00122 int sequence;
00123 char *token;
00124 XML_Parser parser;
00125 xode current;
00126
00127
00128 void (*on_state)(struct jabconn_struct *j, int state);
00129 void (*on_packet)(struct jabconn_struct *j, jabpacket p);
00130 } *jabconn, jabconn_struct;
00131
00132 typedef void (*jabconn_state_h)(jabconn j, int state);
00133 typedef void (*jabconn_packet_h)(jabconn j, jabpacket p);
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143 typedef struct terror_struct
00144 {
00145 int code;
00146 char msg[64];
00147 } terror;
00148
00149 #define TERROR_BAD (terror){400,"Bad Request"}
00150 #define TERROR_AUTH (terror){401,"Unauthorized"}
00151 #define TERROR_PAY (terror){402,"Payment Required"}
00152 #define TERROR_FORBIDDEN (terror){403,"Forbidden"}
00153 #define TERROR_NOTFOUND (terror){404,"Not Found"}
00154 #define TERROR_NOTALLOWED (terror){405,"Not Allowed"}
00155 #define TERROR_NOTACCEPTABLE (terror){406,"Not Acceptable"}
00156 #define TERROR_REGISTER (terror){407,"Registration Required"}
00157 #define TERROR_REQTIMEOUT (terror){408,"Request Timeout"}
00158 #define TERROR_CONFLICT (terror){409,"Conflict"}
00159 #define TERROR_INTERNAL (terror){500,"Internal Server Error"}
00160 #define TERROR_NOTIMPL (terror){501,"Not Implemented"}
00161 #define TERROR_EXTERNAL (terror){502,"Remote Server Error"}
00162 #define TERROR_UNAVAIL (terror){503,"Service Unavailable"}
00163 #define TERROR_EXTTIMEOUT (terror){504,"Remote Server Timeout"}
00164 #define TERROR_DISCONNECTED (terror){510,"Disconnected"}
00165
00166
00167 #define NSCHECK(x,n) (j_strcmp(xmlnode_get_attrib(x,"xmlns"),n) == 0)
00168
00169 #define NS_CLIENT "jabber:client"
00170 #define NS_SERVER "jabber:server"
00171 #define NS_AUTH "jabber:iq:auth"
00172 #define NS_REGISTER "jabber:iq:register"
00173 #define NS_ROSTER "jabber:iq:roster"
00174 #define NS_OFFLINE "jabber:x:offline"
00175 #define NS_AGENT "jabber:iq:agent"
00176 #define NS_AGENTS "jabber:iq:agents"
00177 #define NS_DELAY "jabber:x:delay"
00178 #define NS_VERSION "jabber:iq:version"
00179 #define NS_TIME "jabber:iq:time"
00180 #define NS_VCARD "vcard-temp"
00181 #define NS_PRIVATE "jabber:iq:private"
00182 #define NS_SEARCH "jabber:iq:search"
00183 #define NS_OOB "jabber:iq:oob"
00184 #define NS_XOOB "jabber:x:oob"
00185 #define NS_ADMIN "jabber:iq:admin"
00186 #define NS_FILTER "jabber:iq:filter"
00187 #define NS_AUTH_0K "jabber:iq:auth:0k"
00188 #define NS_BROWSE "jabber:iq:browse"
00189 #define NS_EVENT "jabber:x:event"
00190 #define NS_CONFERENCE "jabber:iq:conference"
00191 #define NS_SIGNED "jabber:x:signed"
00192 #define NS_ENCRYPTED "jabber:x:encrypted"
00193 #define NS_GATEWAY "jabber:iq:gateway"
00194 #define NS_LAST "jabber:iq:last"
00195 #define NS_ENVELOPE "jabber:x:envelope"
00196 #define NS_EXPIRE "jabber:x:expire"
00197 #define NS_XHTML "http://www.w3.org/1999/xhtml"
00198 #define NS_XDBGINSERT "jabber:xdb:ginsert"
00199 #define NS_XDBNSLIST "jabber:xdb:nslist"
00200 #define NS_DATA "jabber:x:data"
00201
00202
00203 #define TMSG_NORMAL "normal"
00204 #define TMSG_ERROR "error"
00205 #define TMSG_CHAT "chat"
00206 #define TMSG_GROUPCHAT "groupchat"
00207 #define TMSG_HEADLINE "headline"
00208
00209
00210 #endif