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

Function dm_api_send_req_async

modules/aaa_diameter/dm_impl.c:2170–2204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2168}
2169
2170int dm_api_send_req_async(diameter_conn *conn, int app_id, int cmd_code, cJSON *req,
2171 diameter_reply_cb *reply_cb, void *reply_param)
2172{
2173 aaa_message *dmsg = NULL;
2174
2175 if (!req) {
2176 LM_ERR("no request provided\n");
2177 return -1;
2178 }
2179
2180 if (req->type != cJSON_Array) {
2181 LM_ERR("request must be an array\n");
2182 return -2;
2183 }
2184
2185 dmsg = _dm_create_message(NULL, AAA_CUSTOM_REQ, app_id, cmd_code, NULL);
2186 if (!dmsg) {
2187 LM_ERR("oom\n");
2188 return -1;
2189 }
2190
2191 if (dm_build_avps(&((struct dm_message *)(dmsg->avpair))->avps,
2192 req->child) != 0) {
2193 LM_ERR("failed to unpack JSON\n");
2194 _dm_destroy_message(dmsg);
2195 return -1;
2196 }
2197
2198 if (_dm_send_message_callback(NULL, dmsg, reply_cb, reply_param) != 0) {
2199 LM_ERR("could not send Diameter callback message\n");
2200 return -1;
2201 }
2202 return 0;
2203
2204}
2205
2206cJSON *dm_api_get_reply(diameter_reply *rpl)
2207{

Callers

nothing calls this directly

Calls 4

_dm_create_messageFunction · 0.85
dm_build_avpsFunction · 0.85
_dm_destroy_messageFunction · 0.85

Tested by

no test coverage detected