Skip to content

Commit

Permalink
h350: 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 2209444 commit 003cfd2
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 53 deletions.
8 changes: 5 additions & 3 deletions src/modules/h350/h350_exp_fn.c
Expand Up @@ -33,8 +33,10 @@
#include "../../core/ut.h"
#include "../../core/mem/mem.h"

#define H350_SIPURI_LOOKUP_LDAP_FILTER "(&(objectClass=SIPIdentity)(SIPIdentitySIPURI=%s))"
#define H350_AUTH_FILTER_PATTERN "(&(objectClass=SIPIdentity)(SIPIdentityUserName=%s))"
#define H350_SIPURI_LOOKUP_LDAP_FILTER \
"(&(objectClass=SIPIdentity)(SIPIdentitySIPURI=%s))"
#define H350_AUTH_FILTER_PATTERN \
"(&(objectClass=SIPIdentity)(SIPIdentityUserName=%s))"

static str h350_call_pref_name = str_init("callPreferenceURI");
static str h350_sip_pwd_name = str_init("SIPIdentityPassword");
Expand All @@ -46,7 +48,7 @@ static str h350_service_level_name = str_init("SIPIdentityServiceLevel");
#define AVP_NAME_STR_BUF_LEN 1024
#define DIGEST_USERNAME_BUF_SIZE 2048

static regex_t* call_pref_preg;
static regex_t *call_pref_preg;

int h350_sipuri_lookup(struct sip_msg *_msg, pv_elem_t *_sip_uri)
{
Expand Down
16 changes: 7 additions & 9 deletions src/modules/h350/h350_exp_fn.h
Expand Up @@ -36,21 +36,19 @@

struct h350_auth_lookup_avp_params
{
pv_spec_t username_avp_spec;
pv_spec_t password_avp_spec;
pv_spec_t username_avp_spec;
pv_spec_t password_avp_spec;
};

int h350_exp_fn_init(void);

int h350_sipuri_lookup(struct sip_msg* _msg, pv_elem_t* _sip_uri);
int h350_sipuri_lookup(struct sip_msg *_msg, pv_elem_t *_sip_uri);

int h350_auth_lookup(
struct sip_msg* _msg,
pv_elem_t* _digest_username,
struct h350_auth_lookup_avp_params* _avp_specs);
int h350_auth_lookup(struct sip_msg *_msg, pv_elem_t *_digest_username,
struct h350_auth_lookup_avp_params *_avp_specs);

int h350_call_preferences(struct sip_msg* _msg, pv_elem_t* _avp_name_prefix);
int h350_call_preferences(struct sip_msg *_msg, pv_elem_t *_avp_name_prefix);

int h350_service_level(struct sip_msg* _msg, pv_elem_t* _avp_name_prefix);
int h350_service_level(struct sip_msg *_msg, pv_elem_t *_avp_name_prefix);

#endif /* H350_EXP_FN_H */
80 changes: 42 additions & 38 deletions src/modules/h350/h350_mod.c
Expand Up @@ -41,24 +41,27 @@ static int child_init(int rank);
/*
* fixup functions
*/
static int one_str_pv_elem_fixup(void** param, int param_no);
static int h350_auth_lookup_fixup(void** param, int param_no);
static int one_str_pv_elem_fixup(void **param, int param_no);
static int h350_auth_lookup_fixup(void **param, int param_no);

/*
* exported functions
*/

static int w_h350_sipuri_lookup(struct sip_msg* msg, char* sip_uri, char* s2);
static int w_h350_auth_lookup(struct sip_msg* msg, char* digest_username, char* avp_specs);
static int w_h350_call_preferences(struct sip_msg* msg, char* avp_name_prefix, char* s2);
static int w_h350_service_level(struct sip_msg* msg, char* avp_name_prefix, char* s2);
static int w_h350_sipuri_lookup(struct sip_msg *msg, char *sip_uri, char *s2);
static int w_h350_auth_lookup(
struct sip_msg *msg, char *digest_username, char *avp_specs);
static int w_h350_call_preferences(
struct sip_msg *msg, char *avp_name_prefix, char *s2);
static int w_h350_service_level(
struct sip_msg *msg, char *avp_name_prefix, char *s2);

/*
* Module parameter variables
*/
char* h350_ldap_session = H350_LDAP_SESSION;
char* h350_base_dn = H350_BASE_DN;
char* h350_search_scope = H350_SEARCH_SCOPE;
char *h350_ldap_session = H350_LDAP_SESSION;
char *h350_base_dn = H350_BASE_DN;
char *h350_search_scope = H350_SEARCH_SCOPE;
int h350_search_scope_int = -1;


Expand All @@ -71,47 +74,48 @@ ldap_api_t ldap_api;
* Exported functions
*/
static cmd_export_t cmds[] = {
{"h350_sipuri_lookup", (cmd_function)w_h350_sipuri_lookup, 1,
one_str_pv_elem_fixup, 0,
REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|ONREPLY_ROUTE|LOCAL_ROUTE},
{"h350_auth_lookup", (cmd_function)w_h350_auth_lookup, 2,
h350_auth_lookup_fixup, 0,
REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|ONREPLY_ROUTE|LOCAL_ROUTE},
{"h350_result_call_preferences", (cmd_function)w_h350_call_preferences, 1,
one_str_pv_elem_fixup, 0,
REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|ONREPLY_ROUTE|LOCAL_ROUTE},
{"h350_result_service_level", (cmd_function)w_h350_service_level, 1,
one_str_pv_elem_fixup, 0,
REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|ONREPLY_ROUTE|LOCAL_ROUTE},
{0, 0, 0, 0, 0, 0}
};
{"h350_sipuri_lookup", (cmd_function)w_h350_sipuri_lookup, 1,
one_str_pv_elem_fixup, 0,
REQUEST_ROUTE | FAILURE_ROUTE | BRANCH_ROUTE | ONREPLY_ROUTE
| LOCAL_ROUTE},
{"h350_auth_lookup", (cmd_function)w_h350_auth_lookup, 2,
h350_auth_lookup_fixup, 0,
REQUEST_ROUTE | FAILURE_ROUTE | BRANCH_ROUTE | ONREPLY_ROUTE
| LOCAL_ROUTE},
{"h350_result_call_preferences", (cmd_function)w_h350_call_preferences,
1, one_str_pv_elem_fixup, 0,
REQUEST_ROUTE | FAILURE_ROUTE | BRANCH_ROUTE | ONREPLY_ROUTE
| LOCAL_ROUTE},
{"h350_result_service_level", (cmd_function)w_h350_service_level, 1,
one_str_pv_elem_fixup, 0,
REQUEST_ROUTE | FAILURE_ROUTE | BRANCH_ROUTE | ONREPLY_ROUTE
| LOCAL_ROUTE},
{0, 0, 0, 0, 0, 0}};


/*
* Exported parameters
*/
static param_export_t params[] = {
{"ldap_session", PARAM_STRING, &h350_ldap_session},
{"base_dn", PARAM_STRING, &h350_base_dn},
{"search_scope", PARAM_STRING, &h350_search_scope},
{0, 0, 0}
};
{"ldap_session", PARAM_STRING, &h350_ldap_session},
{"base_dn", PARAM_STRING, &h350_base_dn},
{"search_scope", PARAM_STRING, &h350_search_scope}, {0, 0, 0}};


/*
* Module interface
*/
struct module_exports exports = {
"h350", /* module name */
DEFAULT_DLFLAGS, /* dlopen flags */
cmds, /* cmd (cfg function) exports */
params, /* Exported parameters */
0, /* RPC method exports */
0, /* exported pseudo-variables */
0, /* response function */
mod_init, /* module initialization function */
child_init, /* child initialization function */
0 /* destroy function */
"h350", /* module name */
DEFAULT_DLFLAGS, /* dlopen flags */
cmds, /* cmd (cfg function) exports */
params, /* Exported parameters */
0, /* RPC method exports */
0, /* exported pseudo-variables */
0, /* response function */
mod_init, /* module initialization function */
child_init, /* child initialization function */
0 /* destroy function */
};

static int child_init(int rank)
Expand Down
6 changes: 3 additions & 3 deletions src/modules/h350/h350_mod.h
Expand Up @@ -44,9 +44,9 @@ extern ldap_api_t ldap_api;
#define H350_BASE_DN ""
#define H350_SEARCH_SCOPE "one"

extern char* h350_ldap_session;
extern char* h350_base_dn;
extern char* h350_search_scope;
extern char *h350_ldap_session;
extern char *h350_base_dn;
extern char *h350_search_scope;
extern int h350_search_scope_int;

#endif /* H350_MOD_H */

0 comments on commit 003cfd2

Please sign in to comment.