00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00044 #include <jabberd.h>
00045
00047 typedef struct db_struct {
00048 instance i;
00049 xht nscache;
00050 xht out_connecting;
00051 xht out_ok_db;
00052 xht in_id;
00053 xht in_ok_db;
00054 xht hosts_xmpp;
00055 xht hosts_tls;
00056 xht hosts_auth;
00057 char *secret;
00058 int timeout_packets;
00059 int timeout_idle;
00060 int timeout_auth;
00061 xht std_ns_prefixes;
00062 xdbcache xc;
00063 } *db, _db;
00064
00066 typedef struct miod_struct
00067 {
00068 mio m;
00069 int last;
00070 int count;
00071 db d;
00072 } *miod, _miod;
00073
00074 void dialback_out_packet(db d, xmlnode x, char *ip);
00075 result dialback_out_beat_packets(void *arg);
00076
00077 void dialback_in_read(mio s, int flags, void *arg, xmlnode x, char* unused1, int unused2);
00078 void dialback_in_verify(db d, xmlnode x);
00079
00080 int dialback_check_settings(db d, mio m, const char *server, int is_outgoing, int auth_type, int version);
00081 char *dialback_randstr(void);
00082 char *dialback_merlin(pool p, char const* secret, char const* to, char const* from, char const* challenge);
00083 void dialback_miod_hash(miod md, xht ht, jid key);
00084 miod dialback_miod_new(db d, mio m);
00085 void dialback_miod_write(miod md, xmlnode x);
00086 void dialback_miod_read(miod md, xmlnode x);
00087 char *dialback_ip_get(db d, jid host, char *ip);
00088 void dialback_ip_set(db d, jid host, char *ip);
00089
00090 const char* dialback_get_loopcheck_token(db d);
00091
00093 typedef struct dboq_struct
00094 {
00095 int stamp;
00096 xmlnode x;
00097 struct dboq_struct *next;
00098 } *dboq, _dboq;
00099
00103 typedef enum {
00104 not_requested,
00105 could_request,
00106 want_request,
00107 sent_request
00108 } db_request;
00109
00115 typedef enum {
00116 created,
00117 connecting,
00118 connected,
00119 got_streamroot,
00120 waiting_features,
00121 got_features,
00122 sent_db_request,
00123 db_succeeded,
00124 db_failed,
00125 sasl_started,
00126 sasl_fail,
00127 sasl_success
00128 } db_connection_state;
00129
00130
00134 typedef struct {
00135 char *ip;
00136 int stamp;
00137 db d;
00138 jid key;
00139 xmlnode verifies;
00140 pool p;
00141 dboq q;
00142 mio m;
00143
00144 int xmpp_version;
00145 int settings_failed;
00146 char *stream_id;
00147 db_request db_state;
00148 db_connection_state connection_state;
00149 std::ostringstream* connect_results;
00150 struct {
00151 int db:1;
00152 } flags;
00153 } *dboc, _dboc;
00154
00158 typedef struct dbic_struct {
00159 mio m;
00160 char *id;
00161 xmlnode results;
00166 db d;
00167 char *we_domain;
00170 char *other_domain;
00171 int xmpp_version;
00172 time_t stamp;
00173 } *dbic, _dbic;