diff --git a/context.c b/context.c index 912401861a..c3fc8e19af 100644 --- a/context.c +++ b/context.c @@ -47,7 +47,7 @@ context_p context_alloc(void) return ctx; } -inline int context_register_int(enum osips_context type) +int context_register_int(enum osips_context type) { context_sizes[type] += sizeof(int); type_offsets[type][1] += sizeof(int); @@ -56,7 +56,7 @@ inline int context_register_int(enum osips_context type) return type_sizes[type][0]++; } -inline int context_register_str(enum osips_context type) +int context_register_str(enum osips_context type) { context_sizes[type] += sizeof(str); type_offsets[type][2] += sizeof(str); @@ -64,14 +64,14 @@ inline int context_register_str(enum osips_context type) return type_sizes[type][1]++; } -inline int context_register_ptr(enum osips_context type) +int context_register_ptr(enum osips_context type) { context_sizes[type] += sizeof(void *); return type_sizes[type][2]++; } -inline void context_put_int(enum osips_context type, context_p ctx, +void context_put_int(enum osips_context type, context_p ctx, int pos, int data) { #ifdef DBG_QM_MALLOC @@ -87,7 +87,7 @@ inline void context_put_int(enum osips_context type, context_p ctx, ((int *)ctx)[pos] = data; } -inline void context_put_str(enum osips_context type, context_p ctx, +void context_put_str(enum osips_context type, context_p ctx, int pos, str *data) { #ifdef DBG_QM_MALLOC @@ -103,7 +103,7 @@ inline void context_put_str(enum osips_context type, context_p ctx, ((str *)((char *)ctx + type_offsets[type][1]))[pos] = *data; } -inline void context_put_ptr(enum osips_context type, context_p ctx, +void context_put_ptr(enum osips_context type, context_p ctx, int pos, void *data) { #ifdef DBG_QM_MALLOC @@ -119,7 +119,7 @@ inline void context_put_ptr(enum osips_context type, context_p ctx, ((void **)((char *)ctx + type_offsets[type][2]))[pos] = data; } -inline int context_get_int(enum osips_context type, context_p ctx, int pos) +int context_get_int(enum osips_context type, context_p ctx, int pos) { #ifdef DBG_QM_MALLOC if (pos < 0 || pos >= type_sizes[type][0]) { @@ -134,7 +134,7 @@ inline int context_get_int(enum osips_context type, context_p ctx, int pos) return ((int *)ctx)[pos]; } -inline str *context_get_str(enum osips_context type, context_p ctx, int pos) +str *context_get_str(enum osips_context type, context_p ctx, int pos) { #ifdef DBG_QM_MALLOC if (pos < 0 || pos >= type_sizes[type][1]) { @@ -149,7 +149,7 @@ inline str *context_get_str(enum osips_context type, context_p ctx, int pos) return &((str *)((char *)ctx + type_offsets[type][1]))[pos]; } -inline void *context_get_ptr(enum osips_context type, context_p ctx, int pos) +void *context_get_ptr(enum osips_context type, context_p ctx, int pos) { #ifdef DBG_QM_MALLOC if (pos < 0 || pos >= type_sizes[type][2]) { diff --git a/context.h b/context.h index 207c734848..c2a36368d9 100644 --- a/context.h +++ b/context.h @@ -67,19 +67,19 @@ context_p context_alloc(void); * * - they reserve and return a position in the context buffer of the given type */ -extern inline int context_register_int(enum osips_context type); -extern inline int context_register_str(enum osips_context type); -extern inline int context_register_ptr(enum osips_context type); +int context_register_int(enum osips_context type); +int context_register_str(enum osips_context type); +int context_register_ptr(enum osips_context type); -extern inline void context_put_int(enum osips_context type, context_p ctx, +void context_put_int(enum osips_context type, context_p ctx, int pos, int data); -extern inline void context_put_str(enum osips_context type, context_p ctx, +void context_put_str(enum osips_context type, context_p ctx, int pos, str *data); -extern inline void context_put_ptr(enum osips_context type, context_p ctx, +void context_put_ptr(enum osips_context type, context_p ctx, int pos, void *data); -extern inline int context_get_int(enum osips_context type, context_p ctx, int pos); -extern inline str *context_get_str(enum osips_context type, context_p ctx, int pos); -extern inline void *context_get_ptr(enum osips_context type, context_p ctx, int pos); +int context_get_int(enum osips_context type, context_p ctx, int pos); +str *context_get_str(enum osips_context type, context_p ctx, int pos); +void *context_get_ptr(enum osips_context type, context_p ctx, int pos); #endif /* __CONTEXT_H */ diff --git a/core_stats.c b/core_stats.c index 0b1f51a7ef..2290d2ba05 100644 --- a/core_stats.c +++ b/core_stats.c @@ -36,6 +36,7 @@ #include "statistics.h" #include "globals.h" #include "pt.h" +#include "timer.h" #include #include #include "socket_info.h" @@ -69,8 +70,7 @@ stat_export_t core_stats[] = { {"bad_URIs_rcvd", 0, &bad_URIs }, {"unsupported_methods", 0, &unsupported_methods }, {"bad_msg_hdr", 0, &bad_msg_hdr }, - {"timestamp", STAT_IS_FUNC, (stat_var**)get_ticks }, - {0,0,0} + {"timestamp", STAT_IS_FUNC, (stat_var**)get_ticks }, {0,0,0} }; diff --git a/daemonize.c b/daemonize.c index 4a2dc16088..bba08b4699 100644 --- a/daemonize.c +++ b/daemonize.c @@ -54,7 +54,9 @@ #include #endif +#include "mem/shm_mem.h" #include "daemonize.h" +#include "sr_module.h" #include "globals.h" #include "dprint.h" #include "pt.h" @@ -95,7 +97,7 @@ int create_status_pipe(void) return rc; } -inline void inc_init_timer(void) +void inc_init_timer(void) { LM_DBG("incrementing init timer no\n"); (*init_timer_no)++; diff --git a/daemonize.h b/daemonize.h index 3f98954894..2deaf23681 100644 --- a/daemonize.h +++ b/daemonize.h @@ -36,7 +36,7 @@ int send_status_code(char val); void clean_write_pipeend(void); int create_status_pipe(void); int wait_for_all_children(void); -extern inline void inc_init_timer(void); +void inc_init_timer(void); #define report_failure_status() \ diff --git a/db/db_insertq.c b/db/db_insertq.c index a5e79398c5..e4b70ed3d4 100644 --- a/db/db_insertq.c +++ b/db/db_insertq.c @@ -468,7 +468,7 @@ query_list_t *find_query_list_unsafe(const str *table,db_key_t *cols,int col_no) * * also takes care of initialisation of this is the first process * attempting to execute this type of query */ -inline int con_set_inslist(db_func_t *dbf,db_con_t *con,query_list_t **list, +int con_set_inslist(db_func_t *dbf,db_con_t *con,query_list_t **list, db_key_t *cols,int col_no) { query_list_t *entry; @@ -534,7 +534,7 @@ inline int con_set_inslist(db_func_t *dbf,db_con_t *con,query_list_t **list, } /* clean shm memory used by the rows */ -inline void cleanup_rows(db_val_t **rows) +void cleanup_rows(db_val_t **rows) { int i; @@ -606,7 +606,7 @@ void ql_timer_routine(unsigned int ticks,void *param) } } -inline int ql_flush_rows(db_func_t *dbf,db_con_t *conn,query_list_t *entry) +int ql_flush_rows(db_func_t *dbf,db_con_t *conn,query_list_t *entry) { if (query_buffer_size <= 1 || !entry) return 0; diff --git a/db/db_insertq.h b/db/db_insertq.h index 835f6b4dbe..4bd4476e91 100644 --- a/db/db_insertq.h +++ b/db/db_insertq.h @@ -63,11 +63,10 @@ extern gen_lock_t *ql_lock; int init_ql_support(void); int ql_row_add(query_list_t *entry,const db_val_t *row,db_val_t ***ins_rows); int ql_detach_rows_unsafe(query_list_t *entry,db_val_t ***ins_rows); -extern inline int con_set_inslist(db_func_t *dbf,db_con_t *con, +int con_set_inslist(db_func_t *dbf,db_con_t *con, query_list_t **list,db_key_t *cols,int col_no); void ql_timer_routine(unsigned int ticks,void *param); -extern inline int ql_flush_rows(db_func_t *dbf, - db_con_t *conn,query_list_t *entry); +int ql_flush_rows(db_func_t *dbf, db_con_t *conn,query_list_t *entry); #define CON_RESET_INSLIST(con) \ do { \ @@ -93,7 +92,7 @@ extern inline int ql_flush_rows(db_func_t *dbf, lock_release((entry)->lock); \ } while (0) -extern inline void cleanup_rows(db_val_t **rows); +void cleanup_rows(db_val_t **rows); void handle_ql_shutdown(void); #endif diff --git a/dprint.c b/dprint.c index b07d70861b..1267c0c49e 100644 --- a/dprint.c +++ b/dprint.c @@ -112,35 +112,8 @@ void cleanup_debug(void) debug = &debug_level; } -/* change the default log level of a given process */ -inline void __set_proc_default_debug(int proc_idx, int level) -{ - pt[proc_idx].default_debug = level; -} - -/* change the actual log level of the current process */ -inline void set_proc_debug_level(int level) -{ - __set_proc_debug_level(process_no, level); -} - -/* change the actual log level of a given process */ -inline void __set_proc_debug_level(int proc_idx, int level) -{ - pt[proc_idx].debug = level; -} - -inline void set_global_debug_level(int level) -{ - int i; - - for (i = 0; i < counted_processes; i++) { - __set_proc_default_debug(i, level); - __set_proc_debug_level(i, level); - } -} -inline void reset_proc_debug_level(void) +void reset_proc_debug_level(void) { *debug = *default_debug; } diff --git a/dprint.h b/dprint.h index 83e9c65e3e..6a75f793ea 100644 --- a/dprint.h +++ b/dprint.h @@ -52,6 +52,8 @@ #include #include +#include "pt.h" + #define L_ALERT -3 /*!< Alert level */ #define L_CRIT -2 /*!< Critical level */ #define L_ERR -1 /*!< Error level */ @@ -116,24 +118,43 @@ void dprint (char* format, ...); int str2facility(char *s); -/* set the current and default log levels for all OpenSIPS processes */ -extern inline void set_global_debug_level(int level); - -/* set the log level of the current process */ -extern inline void set_proc_debug_level(int level); - /* * set the (default) log level of a given process * * Note: the index param is not validated! */ -extern inline void __set_proc_debug_level(int proc_idx, int level); -extern inline void __set_proc_default_debug(int proc_idx, int level); +static inline void __set_proc_debug_level(int proc_idx, int level) +{ + pt[proc_idx].debug = level; +} + +static inline void __set_proc_default_debug(int proc_idx, int level) +{ + pt[proc_idx].default_debug = level; +} + +/* set the current and default log levels for all OpenSIPS processes */ +static inline void set_global_debug_level(int level) +{ + int i; + + for (i = 0; i < counted_processes; i++) { + __set_proc_default_debug(i, level); + __set_proc_debug_level(i, level); + } +} + +/* set the log level of the current process */ +static inline void set_proc_debug_level(int level) +{ + __set_proc_debug_level(process_no, level); +} + /* changes the logging level to the default value for the current process */ -extern inline void reset_proc_debug_level(void); +void reset_proc_debug_level(void); -inline static char* dp_time(void) +static inline char* dp_time(void) { time_t ltime; diff --git a/forward.c b/forward.c index 5882a78055..16f40ae805 100644 --- a/forward.c +++ b/forward.c @@ -71,6 +71,7 @@ #include "sr_module.h" #include "ip_addr.h" #include "resolve.h" +#include "net/trans.h" #include "name_alias.h" #include "socket_info.h" #include "core_stats.h" diff --git a/io_wait.h b/io_wait.h index 11a49ea4be..de7f816a0f 100644 --- a/io_wait.h +++ b/io_wait.h @@ -89,6 +89,7 @@ #include "poll_types.h" /* poll_types*/ #include "pt.h" /* mypid() */ +#include "error.h" #ifndef FD_TYPE_DEFINED typedef int fd_type; diff --git a/mem/mem.c b/mem/mem.c index ed1d5d8788..5e09a2b5d5 100644 --- a/mem/mem.c +++ b/mem/mem.c @@ -166,7 +166,7 @@ void pkg_event_raise(long used, long size, long perc) event_pkg_pending = 0; } -inline void pkg_threshold_check(void) +void pkg_threshold_check(void) { long pkg_perc, used, size; diff --git a/mem/meminfo.h b/mem/meminfo.h index e67bbb81b4..053e0a4335 100644 --- a/mem/meminfo.h +++ b/mem/meminfo.h @@ -44,7 +44,7 @@ struct mem_info{ // threshold percentage checked extern long event_pkg_threshold; // events are used only if STATISTICS are used -extern inline void pkg_threshold_check(void); +void pkg_threshold_check(void); #else #define pkg_threshold_check() #endif /* STATISTICS */ diff --git a/modules/alias_db/alookup.c b/modules/alias_db/alookup.c index d334b3c8f4..cf63bfbc59 100644 --- a/modules/alias_db/alookup.c +++ b/modules/alias_db/alookup.c @@ -217,7 +217,7 @@ static int alias_db_query(struct sip_msg* _msg, char* _table, } -inline int set_alias_to_ruri(struct sip_msg* _msg, str *alias, int no, void *p) +static inline int set_alias_to_ruri(struct sip_msg* _msg, str *alias, int no, void *p) { /* set the RURI */ if(no==0) { @@ -248,7 +248,7 @@ int alias_db_lookup(struct sip_msg* _msg, char* _table, char *flags) } -inline int set_alias_to_pvar(struct sip_msg* _msg, str *alias, int no, void *p) +static inline int set_alias_to_pvar(struct sip_msg* _msg, str *alias, int no, void *p) { pv_value_t val; pv_spec_t *pvs=(pv_spec_t*)p; diff --git a/modules/benchmark/benchmark.h b/modules/benchmark/benchmark.h index 7ff14e117e..c87107cb2e 100644 --- a/modules/benchmark/benchmark.h +++ b/modules/benchmark/benchmark.h @@ -60,7 +60,7 @@ typedef struct benchmark_timer struct benchmark_timer *next; } benchmark_timer_t; -extern inline int bm_get_time(bm_timeval_t *t) +static inline int bm_get_time(bm_timeval_t *t) { #ifdef BM_CLOCK_REALTIME if(clock_gettime(CLOCK_REALTIME, t)!=0) @@ -75,7 +75,7 @@ extern inline int bm_get_time(bm_timeval_t *t) return 0; } -extern inline unsigned long long bm_diff_time(bm_timeval_t *t1, bm_timeval_t *t2) +static inline unsigned long long bm_diff_time(bm_timeval_t *t1, bm_timeval_t *t2) { unsigned long long tdiff; diff --git a/modules/dialog/dlg_hash.c b/modules/dialog/dlg_hash.c index 303984b759..2c851dc210 100644 --- a/modules/dialog/dlg_hash.c +++ b/modules/dialog/dlg_hash.c @@ -215,7 +215,7 @@ static inline void free_dlg_dlg(struct dlg_cell *dlg) } -inline void destroy_dlg(struct dlg_cell *dlg) +void destroy_dlg(struct dlg_cell *dlg) { int ret = 0; @@ -721,7 +721,7 @@ void link_dlg(struct dlg_cell *dlg, int n) -inline void unlink_unsafe_dlg(struct dlg_entry *d_entry, +void unlink_unsafe_dlg(struct dlg_entry *d_entry, struct dlg_cell *dlg) { if (dlg->next) diff --git a/modules/dialog/dlg_hash.h b/modules/dialog/dlg_hash.h index 0696953bfa..cfe2b9b080 100644 --- a/modules/dialog/dlg_hash.h +++ b/modules/dialog/dlg_hash.h @@ -222,8 +222,8 @@ static inline str* dlg_leg_to_uri(struct dlg_cell *dlg,int leg_no) return &dlg->to_uri; } -extern inline void unlink_unsafe_dlg(struct dlg_entry *d_entry, struct dlg_cell *dlg); -extern inline void destroy_dlg(struct dlg_cell *dlg); +void unlink_unsafe_dlg(struct dlg_entry *d_entry, struct dlg_cell *dlg); +void destroy_dlg(struct dlg_cell *dlg); #define ref_dlg_unsafe(_dlg,_cnt) \ do { \ diff --git a/modules/dispatcher/ds_fixups.c b/modules/dispatcher/ds_fixups.c index 740ae7ba89..36c84e1979 100644 --- a/modules/dispatcher/ds_fixups.c +++ b/modules/dispatcher/ds_fixups.c @@ -582,7 +582,7 @@ void free_int_list(int_list_t *start, int_list_t *end) * Get a partition and a set from a general ds_param structure */ -inline int fixup_get_partition_set(struct sip_msg *msg, const ds_param_t *param, +int fixup_get_partition_set(struct sip_msg *msg, const ds_param_t *param, ds_partition_t **partition, unsigned int *uset) { if (fixup_get_partition(msg, ¶m->partition, partition) != 0) diff --git a/modules/dispatcher/ds_fixups.h b/modules/dispatcher/ds_fixups.h index bfc4924c31..b8684cfc48 100644 --- a/modules/dispatcher/ds_fixups.h +++ b/modules/dispatcher/ds_fixups.h @@ -84,7 +84,7 @@ void free_int_list(int_list_t *start, int_list_t *end); int fixup_get_partition(struct sip_msg *msg, const gpartition_t *gpart, ds_partition_t **partition); -extern inline int fixup_get_partition_set(struct sip_msg *msg, const ds_param_t *param, +int fixup_get_partition_set(struct sip_msg *msg, const ds_param_t *param, ds_partition_t **partition, unsigned int *uset); int fixup_partition_sets(void **param); int fixup_partition_one_set(void **param); diff --git a/modules/mangler/contact_ops.h b/modules/mangler/contact_ops.h index eb27b00afb..3b18b61648 100644 --- a/modules/mangler/contact_ops.h +++ b/modules/mangler/contact_ops.h @@ -42,7 +42,7 @@ #define DEFAULT_SEPARATOR "*" -char *contact_flds_separator; +extern char *contact_flds_separator; struct uri_format diff --git a/modules/proto_tls/proto_tls.c b/modules/proto_tls/proto_tls.c index 27c5b1b61d..d593f6ce4a 100644 --- a/modules/proto_tls/proto_tls.c +++ b/modules/proto_tls/proto_tls.c @@ -42,6 +42,7 @@ #include "../../net/net_tcp.h" #include "../../socket_info.h" #include "../../tsend.h" +#include "../../timer.h" #include "../../receive.h" #include "../../pt.h" #include "../../parser/msg_parser.h" diff --git a/modules/proto_ws/proto_ws.c b/modules/proto_ws/proto_ws.c index 6e92a086ae..27d725c5a2 100644 --- a/modules/proto_ws/proto_ws.c +++ b/modules/proto_ws/proto_ws.c @@ -37,6 +37,7 @@ #include "../../socket_info.h" #include "../../tsend.h" #include "../../receive.h" +#include "../../timer.h" #include "proto_ws.h" #include "ws.h" diff --git a/modules/proto_ws/ws.c b/modules/proto_ws/ws.c index 879e1eda63..74708c06a9 100644 --- a/modules/proto_ws/ws.c +++ b/modules/proto_ws/ws.c @@ -156,7 +156,7 @@ struct ws_req { #define ROTATE32(_k) ((((_k) & 0xFF) << 24) | ((_k) >> 8)) #define MASK8(_k) ((unsigned char)((_k) & 0xFF)) -void inline ws_print_masked(char *buf, int len) +static inline void ws_print_masked(char *buf, int len) { static char *print_buf; static long print_buf_len = 0; @@ -209,9 +209,8 @@ void inline ws_mask(char *buf, int len, unsigned int mask) } - -int inline ws_send(struct tcp_connection *con, int fd, int op, int should_mask, - unsigned int mask, char *body, unsigned int len) +static inline int ws_send(struct tcp_connection *con, int fd, int op, + char *body, unsigned int len) { static unsigned char hdr_buf[WS_MAX_HDR_LEN]; static struct iovec v[2] = { {hdr_buf, 0}, {0, 0}}; @@ -253,14 +252,14 @@ int inline ws_send(struct tcp_connection *con, int fd, int op, int should_mask, return ws_raw_writev(con, fd, v, 2); } -int inline ws_send_pong(struct tcp_connection *con, struct ws_req *req) +static inline int ws_send_pong(struct tcp_connection *con, struct ws_req *req) { return ws_send(con, con->fd, WS_OP_PONG, !WS_IS_MASKED(req), 0/* XXX: no need to mask for now, only when act as client */, req->tcp.body, req->tcp.content_len); } -int inline ws_send_close(struct tcp_connection *con, int ret) +static inline int ws_send_close(struct tcp_connection *con) { uint16_t code; int len; @@ -288,7 +287,7 @@ int ws_req_write(struct tcp_connection *con, int fd, char *buf, int len) static struct ws_req ws_current_req; -int inline ws_parse(struct ws_req *req) +static enum ws_close_code inline ws_parse(struct ws_req *req) { uint64_t clen; @@ -332,7 +331,7 @@ int inline ws_parse(struct ws_req *req) clen = WS_ELENC(req); if ((clen+WS_MIN_HDR_LEN+WS_ELENC_SIZE+WS_IF_MASK_SIZE(req))> TCP_BUF_SIZE) { - LM_ERR("packet too large, can't fit: %u\n", req->tcp.content_len); + LM_ERR("packet too large, can't fit: %lu\n", clen); req->tcp.error = TCP_REQ_OVERRUN; return WS_ERR_TOO_BIG; } diff --git a/modules/seas/event_dispatcher.c b/modules/seas/event_dispatcher.c index cb9feadeb6..cd4085503d 100644 --- a/modules/seas/event_dispatcher.c +++ b/modules/seas/event_dispatcher.c @@ -63,7 +63,6 @@ struct unc_as unc_as_t[2*MAX_UNC_AS_NR]; /*this is for the Action Dispatcher Process */ struct as_entry *my_as; -extern int process_no; extern int sig_flag; static int process_event_reply(as_p as); diff --git a/modules/seas/ha.c b/modules/seas/ha.c index eb0d694700..a0112ffaac 100644 --- a/modules/seas/ha.c +++ b/modules/seas/ha.c @@ -313,7 +313,7 @@ static inline int send_ping(struct as_entry *the_as,struct timeval *now) * 0 on success * -1 on error */ -inline int init_pingtable(struct ha *table,int timeout,int maxpings) +int init_pingtable(struct ha *table,int timeout,int maxpings) { if(maxpings<=0) maxpings=1; @@ -341,7 +341,7 @@ inline int init_pingtable(struct ha *table,int timeout,int maxpings) return -1; } -inline void destroy_pingtable(struct ha *table) +void destroy_pingtable(struct ha *table) { if(table->mutex){ lock_dealloc(table->mutex); diff --git a/modules/seas/ha.h b/modules/seas/ha.h index 6b4937fce2..6231889e50 100644 --- a/modules/seas/ha.h +++ b/modules/seas/ha.h @@ -58,6 +58,6 @@ char * create_ping_event(int *evt_len,int flags,unsigned int *seqno); int prepare_ha(); int spawn_pinger(); int print_pingtable(struct ha *ta,int idx,int lock); -extern inline int init_pingtable(struct ha *table,int timeout,int maxpings); -extern inline void destroy_pingtable(struct ha *table); +int init_pingtable(struct ha *table,int timeout,int maxpings); +void destroy_pingtable(struct ha *table); #endif diff --git a/modules/seas/statistics.c b/modules/seas/statistics.c index 072d7a2c3b..751a0d6679 100644 --- a/modules/seas/statistics.c +++ b/modules/seas/statistics.c @@ -78,21 +78,11 @@ struct statstable* init_seas_stats_table(void) return seas_stats_table; } -inline void destroy_seas_stats_table(void) -{ - /*deallocs the table*/ - if(seas_stats_table){ - lock_destroy(seas_stats_table->mutex); - shm_free(seas_stats_table); - seas_stats_table=(struct statstable *)0; - } -} - /** This will be called from within w_as_relay() * * TODO handle locking ? */ -inline void as_relay_stat(struct cell *t) +void as_relay_stat(struct cell *t) { struct statscell *s; struct totag_elem *to; @@ -130,7 +120,7 @@ inline void as_relay_stat(struct cell *t) * * TODO handle locking/mutexing ? */ -inline void event_stat(struct cell *t) +void event_stat(struct cell *t) { struct statscell *s; struct totag_elem *to; @@ -166,7 +156,7 @@ static inline int assignIndex(int i) /** this will be called from the SEAS action dispatcher * when it receives the action from the socket */ -inline void action_stat(struct cell *t) +void action_stat(struct cell *t) { unsigned int seas_dispatch/*,as_delay*/; struct timeval *t1,*t2/*,*t3*/; @@ -302,7 +292,7 @@ int start_stats_server(char *stats_socket) * 1 if stats properly started * -1 if error */ -inline int stop_stats_server(void) +int stop_stats_server(void) { if(pid) kill(SIGTERM,pid); @@ -367,7 +357,7 @@ void serve_stats(int fd) * this limit then the return value is the number of characters (not including the trailing '\\0') which would have been written to the final string * if enough space had been available. Thus, a return value of size or more means that the output was truncated." */ -inline int print_stats_info(int f,int sock) +int print_stats_info(int f,int sock) { #define STATS_BUF_SIZE 400 int j,k,writen; @@ -439,11 +429,4 @@ inline int print_stats_info(int f,int sock) return -1; } -inline void stats_reply(void) -{ - lock_get(seas_stats_table->mutex); - seas_stats_table->received_replies++; - lock_release(seas_stats_table->mutex); -} - diff --git a/modules/seas/statistics.h b/modules/seas/statistics.h index ca1ceca836..426188a0c0 100644 --- a/modules/seas/statistics.h +++ b/modules/seas/statistics.h @@ -69,21 +69,36 @@ extern struct statstable *seas_stats_table; * Initialize and destroy statistics table */ struct statstable* init_seas_stats_table(); -extern inline int stop_stats_server(); -extern inline void destroy_seas_stats_table(); +int stop_stats_server(); +static inline void destroy_seas_stats_table(void) +{ + /*deallocs the table*/ + if(seas_stats_table){ + lock_destroy(seas_stats_table->mutex); + shm_free(seas_stats_table); + seas_stats_table=(struct statstable *)0; + } +} /** Statistics server process * functions */ void serve_stats(int fd); int start_stats_server(char *socket); -extern inline int print_stats_info(int f,int sock); +int print_stats_info(int f,int sock); /** * Statistics functions */ -extern inline void as_relay_stat(struct cell *t); -extern inline void event_stat(struct cell *t); -extern inline void action_stat(struct cell *t); -extern inline void stats_reply(); +void as_relay_stat(struct cell *t); +void event_stat(struct cell *t); +void action_stat(struct cell *t); + +static inline void stats_reply(void) +{ + lock_get(seas_stats_table->mutex); + seas_stats_table->received_replies++; + lock_release(seas_stats_table->mutex); +} + #define receivedplus() \ do{ \ lock_get(seas_stats_table->mutex); \ diff --git a/modules/sms/sms_funcs.c b/modules/sms/sms_funcs.c index 3d5de9a8be..72a5f9670b 100644 --- a/modules/sms/sms_funcs.c +++ b/modules/sms/sms_funcs.c @@ -302,7 +302,7 @@ int send_sip_msg_request(str *to, str *from_user, str *body) -inline int send_error(struct sms_msg *sms_messg, char *msg1_s, int msg1_len, +static inline int send_error(struct sms_msg *sms_messg, char *msg1_s, int msg1_len, char *msg2_s, int msg2_len) { str body; diff --git a/modules/sms/sms_report.c b/modules/sms/sms_report.c index 7a41603542..4ebcabfe0f 100644 --- a/modules/sms/sms_report.c +++ b/modules/sms/sms_report.c @@ -80,7 +80,7 @@ void set_gettime_function(void) -inline void free_report_cell(struct report_cell *cell) +static inline void free_report_cell(struct report_cell *cell) { if (!cell) return; diff --git a/modules/tm/t_funcs.c b/modules/tm/t_funcs.c index d0e88690c6..e12709a229 100644 --- a/modules/tm/t_funcs.c +++ b/modules/tm/t_funcs.c @@ -268,31 +268,3 @@ int t_relay_to( struct sip_msg *p_msg , struct proxy_l *proxy, int flags) return ret; } -inline void _set_fr_retr( struct retr_buf *rb, int retr ) -{ - utime_t timer; - - if (retr && !rb->retr_timer.deleted) { - rb->retr_list=RT_T1_TO_1; - set_timer( &rb->retr_timer, RT_T1_TO_1, NULL ); - } - - if (!rb->my_T || !is_timeout_set(rb->my_T->fr_timeout)) - set_1timer(&rb->fr_timer, FR_TIMER_LIST, NULL); - else { - timer = rb->my_T->fr_timeout; - set_1timer(&rb->fr_timer, FR_TIMER_LIST, &timer); - } -} - - -inline void start_retr(struct retr_buf *rb) -{ - _set_fr_retr(rb, rb->dst.proto==PROTO_UDP); -} - - -inline void force_retr(struct retr_buf *rb) -{ - _set_fr_retr(rb, 1); -} diff --git a/modules/tm/t_funcs.h b/modules/tm/t_funcs.h index b3547c9cb1..ac665e24f5 100644 --- a/modules/tm/t_funcs.h +++ b/modules/tm/t_funcs.h @@ -128,9 +128,34 @@ int send_pr_buffer( struct retr_buf *rb, void *buf, int len, void* ctx); #define unset_timeout(timeout) ((timeout) = 0) #define is_timeout_set(timeout) ((timeout) != 0) -extern inline void set_fr_retr(struct retr_buf *rb, int retr ); -extern inline void start_retr(struct retr_buf *rb); -extern inline void force_retr(struct retr_buf *rb); +static inline void _set_fr_retr( struct retr_buf *rb, int retr ) +{ + utime_t timer; + + if (retr && !rb->retr_timer.deleted) { + rb->retr_list=RT_T1_TO_1; + set_timer( &rb->retr_timer, RT_T1_TO_1, NULL ); + } + + if (!rb->my_T || !is_timeout_set(rb->my_T->fr_timeout)) + set_1timer(&rb->fr_timer, FR_TIMER_LIST, NULL); + else { + timer = rb->my_T->fr_timeout; + set_1timer(&rb->fr_timer, FR_TIMER_LIST, &timer); + } +} + + +static inline void start_retr(struct retr_buf *rb) +{ + _set_fr_retr(rb, rb->dst.proto==PROTO_UDP); +} + + +static inline void force_retr(struct retr_buf *rb) +{ + _set_fr_retr(rb, 1); +} void tm_shutdown(); diff --git a/msg_translator.c b/msg_translator.c index e589ed0535..4d3d7f18d4 100644 --- a/msg_translator.c +++ b/msg_translator.c @@ -125,6 +125,7 @@ #include "ut.h" #include "pt.h" #include "context.h" +#include "net/trans.h" int disable_503_translation = 0; diff --git a/net/net_tcp.c b/net/net_tcp.c index 335c1c8ee7..7800d40dc7 100644 --- a/net/net_tcp.c +++ b/net/net_tcp.c @@ -47,6 +47,7 @@ #include "../pt.h" #include "../daemonize.h" #include "../reactor.h" +#include "../timer.h" #include "tcp_passfd.h" #include "net_tcp_proc.h" #include "net_tcp.h" diff --git a/net/net_tcp_proc.c b/net/net_tcp_proc.c index 2e5dec5f33..bcacec1d3f 100644 --- a/net/net_tcp_proc.c +++ b/net/net_tcp_proc.c @@ -26,8 +26,10 @@ #include "../timer.h" #include "../reactor.h" +#include "../async.h" #include "tcp_conn.h" #include "tcp_passfd.h" +#include "trans.h" /*!< list of tcp connections handled by this process */ diff --git a/net/net_udp.c b/net/net_udp.c index d2d626f319..ec1576a56b 100644 --- a/net/net_udp.c +++ b/net/net_udp.c @@ -30,6 +30,7 @@ #include "../pt.h" #include "../daemonize.h" #include "../reactor.h" +#include "../timer.h" #include "net_udp.h" diff --git a/parser/parse_to.c b/parser/parse_to.c index 001be8ce4f..2dbdfe4cd6 100644 --- a/parser/parse_to.c +++ b/parser/parse_to.c @@ -65,7 +65,7 @@ enum { -inline void free_to_params(struct to_body* tb) +void free_to_params(struct to_body* tb) { struct to_param *tp=tb->param_lst; struct to_param *foo; diff --git a/parser/parse_to.h b/parser/parse_to.h index f29134a6ef..d20f9b3077 100644 --- a/parser/parse_to.h +++ b/parser/parse_to.h @@ -64,6 +64,6 @@ struct sip_uri *parse_to_uri(struct sip_msg *msg); void free_to(struct to_body* tb); -extern inline void free_to_params(struct to_body *tb); +void free_to_params(struct to_body *tb); #endif diff --git a/pt.h b/pt.h index 1c3f82ba3f..5ca97dd5c3 100644 --- a/pt.h +++ b/pt.h @@ -31,10 +31,7 @@ #include #include -#include "globals.h" -#include "timer.h" -#include "socket_info.h" -#include "atomic.h" +#include "statistics.h" #define MAX_PT_DESC 128 diff --git a/reactor_defs.h b/reactor_defs.h index 5863d1e9ea..d83108ffca 100644 --- a/reactor_defs.h +++ b/reactor_defs.h @@ -36,7 +36,9 @@ */ +#include "ip_addr.h" #include "io_wait.h" +#include "globals.h" struct worker_io_data { /* source info buffer */ diff --git a/resolve.c b/resolve.c index 788a860fe4..3cd1066d66 100644 --- a/resolve.c +++ b/resolve.c @@ -591,7 +591,7 @@ struct hostent * own_gethostbyaddr(void *addr, socklen_t len, int af) } -inline struct hostent* rev_resolvehost(struct ip_addr *ip) +struct hostent* rev_resolvehost(struct ip_addr *ip) { if (dnscache_fetch_func != NULL) { return own_gethostbyaddr((char*)(ip)->u.addr, (ip)->len, (ip)->af); diff --git a/resolve.h b/resolve.h index 6be03f7f72..ce7d06dc49 100644 --- a/resolve.h +++ b/resolve.h @@ -173,9 +173,9 @@ int check_ip_address(struct ip_addr* ip, str *name, struct hostent* sip_resolvehost(str* name, unsigned short* port, unsigned short *proto, int is_sips, struct dns_node **dn); -extern inline struct hostent* resolvehost(char* name, int no_ip_test); +struct hostent* resolvehost(char* name, int no_ip_test); -extern inline struct hostent* rev_resolvehost(struct ip_addr *ip); +struct hostent* rev_resolvehost(struct ip_addr *ip); /*! \brief free the DNS resolver state machine */ void free_dns_res( struct proxy_l *p ); diff --git a/socket_info.c b/socket_info.c index 3f5033352f..28de3dd62b 100644 --- a/socket_info.c +++ b/socket_info.c @@ -101,7 +101,7 @@ /* another helper function, it just creates a socket_info struct */ -inline struct socket_info* new_sock_info( char* name, +struct socket_info* new_sock_info( char* name, unsigned short port, unsigned short proto, char *adv_name, unsigned short adv_port, unsigned short children,enum si_flags flags) diff --git a/socket_info.h b/socket_info.h index b0700e07ee..0fe6e36491 100644 --- a/socket_info.h +++ b/socket_info.h @@ -43,7 +43,7 @@ int add_listen_iface(char* name, unsigned short port, unsigned short proto, char *adv_name, unsigned short adv_port, unsigned short children, enum si_flags flags); -extern inline struct socket_info * +struct socket_info * new_sock_info(char* name, unsigned short port, unsigned short proto, char *adv_name, unsigned short adv_port, unsigned short children, enum si_flags flags); diff --git a/sr_module.c b/sr_module.c index a9339faf10..eca2ac54e5 100644 --- a/sr_module.c +++ b/sr_module.c @@ -40,8 +40,10 @@ #include "sr_module.h" #include "dprint.h" #include "error.h" +#include "globals.h" #include "mem/mem.h" #include "pt.h" +#include "ut.h" #include "daemonize.h" #include @@ -52,6 +54,7 @@ #include #include +#include "net/api_proto.h" #include "net/proto_udp/proto_udp_handler.h" #include "net/proto_tcp/proto_tcp_handler.h" diff --git a/sr_module_deps.c b/sr_module_deps.c index 4ae12b5c2c..055eb2b2df 100644 --- a/sr_module_deps.c +++ b/sr_module_deps.c @@ -24,13 +24,16 @@ #include #include +#include + +#include "sr_module_deps.h" #include "dprint.h" #include "error.h" #include "mem/mem.h" -#include "pt.h" -#include "sr_module_deps.h" +#include "sr_module.h" +#include "pt.h" /* the list head of unsolved module dependencies: struct sr_module ----> "module_name" */ static struct sr_module_dep unsolved_deps; diff --git a/sr_module_deps.h b/sr_module_deps.h index 332e914b5f..6829ea3ffd 100644 --- a/sr_module_deps.h +++ b/sr_module_deps.h @@ -25,8 +25,6 @@ #ifndef SR_MODULE_DEPS_H #define SR_MODULE_DEPS_H -#include "sr_module.h" - /* * Description: * diff --git a/statistics.c b/statistics.c index 472d81e376..817731dd0a 100644 --- a/statistics.c +++ b/statistics.c @@ -46,6 +46,7 @@ #include "statistics.h" #include "pt.h" #include "atomic.h" +#include "globals.h" #include "rw_locking.h" #ifdef STATISTICS diff --git a/ut.c b/ut.c index 56d337c2a1..a40b2cadb6 100644 --- a/ut.c +++ b/ut.c @@ -298,13 +298,3 @@ int base64decode(unsigned char *out,unsigned char *in,int len) return out_len; } -inline int calc_base64_encode_len(int len) -{ - return (len/3 + (len%3?1:0))*4; -} - -inline int calc_max_base64_decode_len(int len) -{ - return len*3/4; -} - diff --git a/ut.h b/ut.h index 9309198dd7..f59aaa2d2f 100644 --- a/ut.h +++ b/ut.h @@ -807,7 +807,15 @@ int parse_reply_codes( str *options_reply_codes_str, void base64encode(unsigned char *out, unsigned char *in, int inlen); int base64decode(unsigned char *out,unsigned char *in,int len); -extern inline int calc_base64_encode_len(int len); -extern inline int calc_max_base64_decode_len(int len); +static inline int calc_base64_encode_len(int len) +{ + return (len/3 + (len%3?1:0))*4; +} + +static inline int calc_max_base64_decode_len(int len) +{ + return len*3/4; +} + #endif