Skip to content

Commit

Permalink
peering: clang-format for coherent indentation and coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxmaniac committed May 18, 2023
1 parent ca32493 commit 4bf8282
Show file tree
Hide file tree
Showing 3 changed files with 350 additions and 360 deletions.
114 changes: 55 additions & 59 deletions src/modules/peering/peering.c
Expand Up @@ -49,55 +49,52 @@ struct attr attrs[A_MAX];
struct val vals[V_MAX];
void *rh;

static int mod_init(void); /* Module initialization function */
static int mod_init(void); /* Module initialization function */


/*
* Module parameter variables
*/
static char* radius_config = DEFAULT_RADIUSCLIENT_CONF;
static char *radius_config = DEFAULT_RADIUSCLIENT_CONF;
int verify_destination_service_type = -1;
int verify_source_service_type = -1;

/*
* Exported functions
*/
static cmd_export_t cmds[] = {
{"verify_destination", (cmd_function)verify_destination, 0, 0, 0,
REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE},
{"verify_source", (cmd_function)verify_source, 0, 0, 0,
REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE},
{0, 0, 0, 0, 0, 0}
};
{"verify_destination", (cmd_function)verify_destination, 0, 0, 0,
REQUEST_ROUTE | FAILURE_ROUTE | BRANCH_ROUTE | LOCAL_ROUTE},
{"verify_source", (cmd_function)verify_source, 0, 0, 0,
REQUEST_ROUTE | FAILURE_ROUTE | BRANCH_ROUTE | LOCAL_ROUTE},
{0, 0, 0, 0, 0, 0}};


/*
* Exported parameters
*/
static param_export_t params[] = {
{"radius_config", PARAM_STRING, &radius_config},
{"verify_destination_service_type", INT_PARAM,
&verify_destination_service_type},
{"verify_source_service_type", INT_PARAM,
&verify_source_service_type},
{0, 0, 0}
};
{"radius_config", PARAM_STRING, &radius_config},
{"verify_destination_service_type", INT_PARAM,
&verify_destination_service_type},
{"verify_source_service_type", INT_PARAM, &verify_source_service_type},
{0, 0, 0}};


/*
* Module interface
*/
struct module_exports exports = {
"peering", /* module name */
DEFAULT_DLFLAGS, /* dlopen flags */
cmds, /* cmd (cfg function) exports */
params, /* param exports */
0, /* RPC method exports */
0, /* pseudo-variables exports */
0, /* response handling function */
mod_init, /* module init function */
0, /* per-child init function */
0 /* module destroy function */
"peering", /* module name */
DEFAULT_DLFLAGS, /* dlopen flags */
cmds, /* cmd (cfg function) exports */
params, /* param exports */
0, /* RPC method exports */
0, /* pseudo-variables exports */
0, /* response handling function */
mod_init, /* module init function */
0, /* per-child init function */
0 /* module destroy function */
};


Expand All @@ -106,38 +103,37 @@ struct module_exports exports = {
*/
static int mod_init(void)
{
memset(attrs, 0, sizeof(attrs));
memset(vals, 0, sizeof(vals));
attrs[A_USER_NAME].n = "User-Name";
attrs[A_SIP_URI_USER].n = "SIP-URI-User";
attrs[A_SIP_FROM_TAG].n = "SIP-From-Tag";
attrs[A_SIP_CALL_ID].n = "SIP-Call-Id";
attrs[A_SIP_REQUEST_HASH].n = "SIP-Request-Hash";
attrs[A_SIP_AVP].n = "SIP-AVP";
attrs[A_SERVICE_TYPE].n = "Service-Type";
vals[V_SIP_VERIFY_DESTINATION].n = "Sip-Verify-Destination";
vals[V_SIP_VERIFY_SOURCE].n = "Sip-Verify-Source";

if ((rh = rc_read_config(radius_config)) == NULL) {
LM_ERR("error opening configuration file\n");
return -1;
}

if (rc_read_dictionary(rh, rc_conf_str(rh, "dictionary")) != 0) {
LM_ERR("error opening dictionary file\n");
return -2;
}

INIT_AV(rh, attrs, A_MAX, vals, V_MAX, "peering", -3, -4);

if (verify_destination_service_type != -1) {
vals[V_SIP_VERIFY_DESTINATION].v =
verify_destination_service_type;
}

if (verify_source_service_type != -1) {
vals[V_SIP_VERIFY_SOURCE].v = verify_source_service_type;
}

return 0;
memset(attrs, 0, sizeof(attrs));
memset(vals, 0, sizeof(vals));
attrs[A_USER_NAME].n = "User-Name";
attrs[A_SIP_URI_USER].n = "SIP-URI-User";
attrs[A_SIP_FROM_TAG].n = "SIP-From-Tag";
attrs[A_SIP_CALL_ID].n = "SIP-Call-Id";
attrs[A_SIP_REQUEST_HASH].n = "SIP-Request-Hash";
attrs[A_SIP_AVP].n = "SIP-AVP";
attrs[A_SERVICE_TYPE].n = "Service-Type";
vals[V_SIP_VERIFY_DESTINATION].n = "Sip-Verify-Destination";
vals[V_SIP_VERIFY_SOURCE].n = "Sip-Verify-Source";

if((rh = rc_read_config(radius_config)) == NULL) {
LM_ERR("error opening configuration file\n");
return -1;
}

if(rc_read_dictionary(rh, rc_conf_str(rh, "dictionary")) != 0) {
LM_ERR("error opening dictionary file\n");
return -2;
}

INIT_AV(rh, attrs, A_MAX, vals, V_MAX, "peering", -3, -4);

if(verify_destination_service_type != -1) {
vals[V_SIP_VERIFY_DESTINATION].v = verify_destination_service_type;
}

if(verify_source_service_type != -1) {
vals[V_SIP_VERIFY_SOURCE].v = verify_source_service_type;
}

return 0;
}

0 comments on commit 4bf8282

Please sign in to comment.