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

Function dm_api_send_req

modules/aaa_diameter/dm_impl.c:2132–2168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2130}
2131
2132int dm_api_send_req(diameter_conn *conn, int app_id, int cmd_code, cJSON *req, diameter_reply *rpl)
2133{
2134 aaa_message *dmsg = NULL;
2135 struct dm_cond *rpl_cond = NULL;
2136 int rc = -1;
2137
2138 if (!req) {
2139 LM_ERR("no request provided\n");
2140 return -1;
2141 }
2142
2143 if (req->type != cJSON_Array) {
2144 LM_ERR("request must be an array\n");
2145 return -2;
2146 }
2147
2148 dmsg = _dm_create_message(NULL, AAA_CUSTOM_REQ, app_id, cmd_code, NULL);
2149 if (!dmsg) {
2150 LM_ERR("oom\n");
2151 return -1;
2152 }
2153
2154 if (dm_build_avps(&((struct dm_message *)(dmsg->avpair))->avps,
2155 req->child) != 0) {
2156 LM_ERR("failed to unpack JSON\n");
2157 _dm_destroy_message(dmsg);
2158 goto end;
2159 }
2160
2161 if (_dm_send_message(NULL, dmsg, &rpl_cond) != 0) {
2162 LM_ERR("could not send Diameter message\n");
2163 goto end;
2164 }
2165 rc = _dm_get_message_reply(rpl_cond, rpl);
2166end:
2167 return rc;
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)

Callers

nothing calls this directly

Calls 5

_dm_create_messageFunction · 0.85
dm_build_avpsFunction · 0.85
_dm_destroy_messageFunction · 0.85
_dm_send_messageFunction · 0.85
_dm_get_message_replyFunction · 0.85

Tested by

no test coverage detected