00001
00002
00003 #ifndef _LIBJWGC_TYPES_H_
00004 #define _LIBJWGC_TYPES_H_ 1
00005
00006 #include "libxode.h"
00007
00008
00009
00010
00011
00012
00013 #define AGENT_NONE 0x0000
00014 #define AGENT_SEARCH 0x0001
00015 #define AGENT_REGISTER 0x0010
00016 #define AGENT_GROUPCHAT 0x0100
00017 #define AGENT_TRANSPORT 0x1000
00018
00019
00020
00021
00022
00023
00024
00025 #define JFORM_INSTRUCTIONS "instructions"
00026 #define JFORM_TITLE "title"
00027 #define JFORM_FIELD "field"
00028
00029 #define JFORM_FIELD_TEXT_SINGLE "text-single"
00030 #define JFORM_FIELD_TEXT_PRIVATE "text-private"
00031 #define JFORM_FIELD_TEXT_MULTI "text-multi"
00032 #define JFORM_FIELD_LIST_SINGLE "list-single"
00033 #define JFORM_FIELD_LIST_MULTI "list-multi"
00034 #define JFORM_FIELD_BOOLEAN "boolean"
00035 #define JFORM_FIELD_FIXED "fixed"
00036 #define JFORM_FIELD_HIDDEN "hidden"
00037 #define JFORM_FIELD_JID_SINGLE "jid-single"
00038 #define JFORM_FIELD_JID_MULTI "jid-multi"
00039
00040
00041
00042
00043
00044
00045
00046 #ifdef XML_UNICODE
00047 #ifdef XML_UNICODE_WCHAR_T
00048 typedef const wchar_t *KEY;
00049 #else
00050 typedef const unsigned short *KEY;
00051 #endif
00052 #else
00053 typedef const char *KEY;
00054 #endif
00055
00056 typedef struct {
00057 KEY name;
00058 } NAMED;
00059
00060 typedef struct {
00061 NAMED **v;
00062 size_t size;
00063 size_t used;
00064 size_t usedLim;
00065 } HASH_TABLE;
00066
00067 typedef struct {
00068 NAMED **p;
00069 NAMED **end;
00070 } HASH_TABLE_ITER;
00071
00072
00073
00074
00075
00076
00077
00078 #ifndef MAXHOSTNAMELEN
00079 #define MAXHOSTNAMELEN 64
00080 #endif
00081
00082 #define NETSOCKET_SERVER 0
00083 #define NETSOCKET_CLIENT 1
00084 #define NETSOCKET_UDP 2
00085
00086
00087
00088
00089
00090
00091
00092 typedef struct {
00093 unsigned long H[5];
00094 unsigned long W[80];
00095 int lenW;
00096 unsigned long sizeHi;
00097 unsigned long sizeLo;
00098 } j_SHA_CTX;
00099
00100
00101
00102
00103
00104
00105
00106 #ifndef DEFVARS
00107 #define DEFVARS "jwgc.vars"
00108 #endif
00109
00110 #ifndef USRVARS
00111 #define USRVARS ".jwgc.vars"
00112 #endif
00113
00114 #ifndef FIXEDVARS
00115 #define FIXEDVARS "jwgc.vars.fixed"
00116 #endif
00117
00118 typedef enum jVar_name {
00119 jVarUsername,
00120 jVarPassword,
00121 jVarServer,
00122 jVarResource,
00123 jVarPort,
00124 jVarPriority,
00125 #ifdef USE_SSL
00126 jVarUseSSL,
00127 #endif
00128 jVarInitProgs,
00129 jVarJID,
00130 jVarPresence,
00131 #ifdef USE_GPGME
00132 jVarUseGPG,
00133 jVarGPGPass,
00134 jVarGPGKeyID,
00135 #endif
00136 jNumVars
00137 } jVar;
00138
00139 typedef enum jVar_type {
00140 jTypeString,
00141 jTypeNumber,
00142 jTypeBool,
00143 jNumTypes
00144 } jVarType;
00145
00146
00147
00148
00149
00150
00151
00152 typedef struct jwgpacket_struct {
00153 int type;
00154 xode x;
00155 xode_pool p;
00156 } *jwgpacket, _jwgpacket;
00157
00158 #define JWGPACKET_UNKNOWN 0
00159 #define JWGPACKET_MESSAGE 1
00160 #define JWGPACKET_LOCATE 2
00161 #define JWGPACKET_STATUS 3
00162 #define JWGPACKET_SHUTDOWN 4
00163 #define JWGPACKET_CHECK 5
00164 #define JWGPACKET_REREAD 6
00165 #define JWGPACKET_SHOWVAR 7
00166 #define JWGPACKET_SUBSCRIBE 8
00167 #define JWGPACKET_UNSUBSCRIBE 9
00168 #define JWGPACKET_NICKNAME 10
00169 #define JWGPACKET_GROUP 11
00170 #define JWGPACKET_REGISTER 12
00171 #define JWGPACKET_SETVAR 13
00172 #define JWGPACKET_JOIN 14
00173 #define JWGPACKET_LEAVE 15
00174 #define JWGPACKET_DEBUG 16
00175 #define JWGPACKET_SEARCH 17
00176 #define JWGPACKET_PING 18
00177
00178 #define JWGCONN_STATE_OFF 0
00179 #define JWGCONN_STATE_CONNECTED 1
00180 #define JWGCONN_STATE_ON 2
00181 #define JWGCONN_STATE_AUTH 3
00182
00183 typedef struct jwgconn_struct {
00184
00185 xode_pool p;
00186 int state;
00187 int fd;
00188 int sckfd;
00189
00190
00191 XML_Parser parser;
00192 xode current;
00193
00194
00195 void (*on_packet)(struct jwgconn_struct *j, jwgpacket p);
00196 } *jwgconn, jwgconn_struct;
00197
00198 typedef void (*jwgconn_packet_h)(jwgconn j, jwgpacket p);
00199
00200
00201 #endif