Skip to content

Commit

Permalink
siputils: 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 6ea356e commit e569931
Show file tree
Hide file tree
Showing 15 changed files with 817 additions and 870 deletions.
356 changes: 156 additions & 200 deletions src/modules/siputils/chargingvector.c

Large diffs are not rendered by default.

381 changes: 193 additions & 188 deletions src/modules/siputils/checks.c

Large diffs are not rendered by default.

51 changes: 25 additions & 26 deletions src/modules/siputils/checks.h
Expand Up @@ -29,7 +29,6 @@
*/



#ifndef CHECKS_H
#define CHECKS_H

Expand All @@ -39,107 +38,107 @@
/*
* Check if given username matches those in digest credentials
*/
int is_user(struct sip_msg* _msg, char* _user, char* _str2);
int is_user(struct sip_msg *_msg, char *_user, char *_str2);


/*
* Check if message includes a to-tag
*/
int has_totag(struct sip_msg* _m);
int w_has_totag(struct sip_msg* _m, char* _foo, char* _bar);
int has_totag(struct sip_msg *_m);
int w_has_totag(struct sip_msg *_m, char *_foo, char *_bar);


/*
* Find if Request URI has a given parameter with no value
*/
int uri_param_1(struct sip_msg* _msg, char* _param, char* _str2);
int uri_param_1(struct sip_msg *_msg, char *_param, char *_str2);


/*
* Find if Request URI has a given parameter with matching value
*/
int uri_param_2(struct sip_msg* _msg, char* _param, char* _value);
int uri_param_2(struct sip_msg *_msg, char *_param, char *_value);


/*
* Adds a new parameter to Request URI
*/
int add_uri_param(struct sip_msg* _msg, char* _param, char* _s2);
int ki_add_uri_param(struct sip_msg* _msg, str* param);
int add_uri_param(struct sip_msg *_msg, char *_param, char *_s2);
int ki_add_uri_param(struct sip_msg *_msg, str *param);

/*
* Converts URI, if it is tel URI, to SIP URI. Returns 1, if
* conversion succeeded or if no conversion was needed, i.e., URI was not
* tel URI. Returns -1, if conversion failed. Takes SIP URI hostpart from
* second parameter and (if needed) writes the result to third parameter.
*/
int tel2sip(struct sip_msg* _msg, char* _uri, char* _hostpart, char* _res);
int tel2sip(struct sip_msg *_msg, char *_uri, char *_hostpart, char *_res);

/*
* Check if pseudo variable contains a valid uri
*/
int is_uri(struct sip_msg* _m, char* _sp, char* _s2);
int is_uri(struct sip_msg *_m, char *_sp, char *_s2);

/*
* Check if user part of URI in pseudo variable is an e164 number
*/
int w_is_uri_user_e164(struct sip_msg* _m, char* _sp, char* _s2);
int w_is_uri_user_e164(struct sip_msg *_m, char *_sp, char *_s2);
int is_uri_user_e164(str *uri);

/*
* Check if pseudo variable argument value is an e164 number
*/
int w_is_e164(struct sip_msg* _m, char* _sp, char* _s2);
int w_is_e164(struct sip_msg *_m, char *_sp, char *_s2);

int siputils_e164_check(str* _user);
int siputils_e164_check(str *_user);

/*
* Set userpart of URI
*/
int set_uri_user(struct sip_msg* _m, char* _uri, char* _value);
int set_uri_user(struct sip_msg *_m, char *_uri, char *_value);

/*
* Set hostpart of URI
*/
int set_uri_host(struct sip_msg* _m, char* _uri, char* _value);
int set_uri_host(struct sip_msg *_m, char *_uri, char *_value);

/*
* Return true (1) if SIP message is request, otherwise false (-1)
*/
int w_is_request(struct sip_msg* msg, char *foo, char *bar);
int is_request(struct sip_msg* msg);
int w_is_request(struct sip_msg *msg, char *foo, char *bar);
int is_request(struct sip_msg *msg);

/*
* Return true (1) if SIP message is reply, otherwise false (-1)
*/
int w_is_reply(struct sip_msg* msg, char *foo, char *bar);
int is_reply(struct sip_msg* msg);
int w_is_reply(struct sip_msg *msg, char *foo, char *bar);
int is_reply(struct sip_msg *msg);

/*
* Find if Request URI has a given parameter with matching value
*/
int get_uri_param(struct sip_msg* _msg, char* _param, char* _value);
int get_uri_param(struct sip_msg *_msg, char *_param, char *_value);

/*
* Check if parameter value has a telephone number format
*/
int is_tel_number(sip_msg_t *msg, char *_sp, char* _s2);
int is_tel_number(sip_msg_t *msg, char *_sp, char *_s2);

/*
* Check if parameter value consists solely of decimal digits
*/
int is_numeric(sip_msg_t *msg, char *_sp, char* _s2);
int is_numeric(sip_msg_t *msg, char *_sp, char *_s2);

/*
* Check if the parameter contains alphanumeric characters
*/
int ksr_is_alphanum(sip_msg_t *msg, char *_sp, char* _s2);
int ksr_is_alphanum(sip_msg_t *msg, char *_sp, char *_s2);

/*
* Check if the parameter contains alphanumeric characters or are part of
* the second parameter
*/
int ksr_is_alphanumex(sip_msg_t *msg, char *_sp, char* _se);
int ksr_is_alphanumex(sip_msg_t *msg, char *_sp, char *_se);

int ki_is_user(sip_msg_t *_m, str *suser);

Expand All @@ -157,10 +156,10 @@ int ki_is_alphanumex(sip_msg_t *msg, str *tval, str *eset);

int ki_uri_param_rm(sip_msg_t *msg, str *sparam);

int w_uri_param_rm(struct sip_msg* _msg, char* _param, char* _str2);
int w_uri_param_rm(struct sip_msg *_msg, char *_param, char *_str2);

int ki_uri_param_any(sip_msg_t *msg, str *sparam);

int w_uri_param_any(struct sip_msg* _msg, char* _param, char* _str2);
int w_uri_param_any(struct sip_msg *_msg, char *_param, char *_str2);

#endif /* CHECKS_H */
21 changes: 10 additions & 11 deletions src/modules/siputils/config.c
Expand Up @@ -29,19 +29,18 @@

#include "config.h"

struct cfg_group_siputils default_siputils_cfg = {
0
};
struct cfg_group_siputils default_siputils_cfg = {0};

void *siputils_cfg = &default_siputils_cfg;
void *siputils_cfg = &default_siputils_cfg;

cfg_def_t siputils_cfg_def[] = {
{"ring_timeout", CFG_VAR_INT | CFG_ATOMIC, 0, 0, ring_timeout_fixup, 0,
"define how long the Call-id is kept in the internal list" },
{0, 0, 0, 0, 0, 0}
};
cfg_def_t siputils_cfg_def[] = {
{"ring_timeout", CFG_VAR_INT | CFG_ATOMIC, 0, 0, ring_timeout_fixup, 0,
"define how long the Call-id is kept in the internal list"},
{0, 0, 0, 0, 0, 0}};

int ring_timeout_fixup(void *handle, str* gname, str* name, void **val){
if((int)(long)*val > 0) return 0;
int ring_timeout_fixup(void *handle, str *gname, str *name, void **val)
{
if((int)(long)*val > 0)
return 0;
return -1;
}
13 changes: 7 additions & 6 deletions src/modules/siputils/config.h
Expand Up @@ -30,14 +30,15 @@
#include "../../core/cfg/cfg.h"
#include "../../core/str.h"

struct cfg_group_siputils {
unsigned int ring_timeout;
struct cfg_group_siputils
{
unsigned int ring_timeout;
};

extern struct cfg_group_siputils default_siputils_cfg;
extern void *siputils_cfg;
extern cfg_def_t siputils_cfg_def[];
extern struct cfg_group_siputils default_siputils_cfg;
extern void *siputils_cfg;
extern cfg_def_t siputils_cfg_def[];

int ring_timeout_fixup(void*, str*, str*, void**);
int ring_timeout_fixup(void *, str *, str *, void **);

#endif

0 comments on commit e569931

Please sign in to comment.