MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / out_stream_node_callback

Function out_stream_node_callback

modules/xmpp/xmpp_server.c:214–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212}
213
214static void out_stream_node_callback(int type, xode node, void *arg)
215{
216 struct xmpp_connection *conn = (struct xmpp_connection *) arg;
217 struct xmpp_connection *in_conn = NULL;
218 char *tag;
219 xode x;
220
221 LM_DBG("outstream callback: %d: %s\n", type,
222 node?xode_get_name(node):"n/a");
223
224 if (conn->domain)
225 in_conn = conn_find_domain(conn->domain, CONN_INBOUND);
226
227 switch (type) {
228 case XODE_STREAM_ROOT:
229 x = xode_new_tag("db:result");
230 xode_put_attrib(x, "xmlns:db", "jabber:server:dialback");
231 xode_put_attrib(x, "from", xmpp_domain);
232 xode_put_attrib(x, "to", conn->domain);
233 //xode_insert_cdata(x, DB_KEY, -1);
234 xode_insert_cdata(x, db_key(local_secret, conn->domain,
235 xode_get_attrib(node, "id")), -1);
236 xode_send(conn->fd, x);
237 xode_free(x);
238
239 break;
240 case XODE_STREAM_NODE:
241 tag = xode_get_name(node);
242
243 if (!strcmp(tag, "db:verify")) {
244 char *from = xode_get_attrib(node, "from");
245 char *to = xode_get_attrib(node, "to");
246 char *id = xode_get_attrib(node, "id");
247 char *type = xode_get_attrib(node, "type");
248 /* char *cdata = xode_get_data(node); */
249
250 if (!strcmp(type, "valid") || !strcmp(type, "invalid")) {
251 /* got a reply, report it */
252 x = xode_new_tag("db:result");
253 xode_put_attrib(x, "xmlns:db", "jabber:server:dialback");
254 xode_put_attrib(x, "from", to);
255 xode_put_attrib(x, "to", from);
256 xode_put_attrib(x, "id", id);
257 xode_put_attrib(x, "type", type);
258 if (in_conn)
259 xode_send(in_conn->fd, x);
260 else
261 LM_ERR("need to send reply to domain '%s', but no inbound"
262 " connection found\n", from);
263 xode_free(x);
264 }
265 } else if (!strcmp(tag, "db:result")) {
266 char *type = xode_get_attrib(node, "type");
267
268 if (type && !strcmp(type, "valid")) {
269 /* the remote server has successfully authenticated us,
270 * we can now send data */
271 for (x = xode_get_firstchild(conn->todo); x;

Callers

nothing calls this directly

Calls 11

conn_find_domainFunction · 0.85
db_keyFunction · 0.85
xode_get_nameFunction · 0.70
xode_new_tagFunction · 0.70
xode_put_attribFunction · 0.70
xode_insert_cdataFunction · 0.70
xode_get_attribFunction · 0.70
xode_sendFunction · 0.70
xode_freeFunction · 0.70
xode_get_firstchildFunction · 0.70
xode_get_nextsiblingFunction · 0.70

Tested by

no test coverage detected