From bebe291656142e65777a4823456eef1737b0f237 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Fri, 5 Jan 2024 11:43:32 +0100 Subject: [PATCH] MT#59086 Unify header files inclusions. In the file implementations follow the rules: 1. Firstly goes the correlated header file, then one empty row. 2. Secondly go system headers, so in angle-brackets, then one empty row. 3. Thirdly, go custom header files, so in double quotes, then one empty row. 4. If there is "xt_RTPENGINE.h", it's mentioned next, but separately, then one empty row. 5. If there are pre-processor definitions, they are added. 6. And eventually at least one empty row before the code. In some situations it's allowed to step aside from the rules, when inclusions are dependent on each other, so on the sequence, and also possibly on some inline objects definitions, but if possible to follow the rules, it's being done. Change-Id: Ie512a970e230fe202398656d1942e8874bb14cd9 --- daemon/bencode.c | 2 ++ daemon/call.c | 3 ++- daemon/call_interfaces.c | 1 - daemon/cdr.c | 4 +++- daemon/cli.c | 5 ++--- daemon/codec.c | 5 ++--- daemon/control_tcp.c | 3 --- daemon/control_udp.c | 1 - daemon/crypto.c | 7 +------ daemon/dtmf.c | 4 +++- daemon/graphite.c | 9 ++------- daemon/helpers.c | 7 ++----- daemon/homer.c | 6 ------ daemon/ice.c | 10 ++-------- daemon/janus.c | 3 ++- daemon/jitter_buffer.c | 6 ++++-- daemon/kernel.c | 12 +----------- daemon/load.c | 2 ++ daemon/log.c | 5 ++--- daemon/media_player.c | 6 ++---- daemon/media_socket.c | 4 +++- daemon/mqtt.c | 2 ++ daemon/nftables.c | 5 +---- daemon/recording.c | 5 ++--- daemon/redis.c | 1 - daemon/rtcp.c | 2 -- daemon/rtp.c | 3 --- daemon/ssrc.c | 4 ++-- daemon/statistics.c | 5 +++-- daemon/stun.c | 2 -- daemon/t38.c | 4 ---- daemon/timerthread.c | 1 + daemon/websocket.c | 2 ++ 33 files changed, 50 insertions(+), 91 deletions(-) diff --git a/daemon/bencode.c b/daemon/bencode.c index a1f0c8618..e8c46c29e 100644 --- a/daemon/bencode.c +++ b/daemon/bencode.c @@ -1,4 +1,5 @@ #include "bencode.h" + #include #include #include @@ -7,6 +8,7 @@ #include #include #include + #include "helpers.h" /* set to 0 for alloc debugging, e.g. through valgrind */ diff --git a/daemon/call.c b/daemon/call.c index e8ee65431..1a1c8dc73 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -24,7 +24,6 @@ #include "control_tcp.h" #include "streambuf.h" #include "redis.h" -#include "xt_RTPENGINE.h" #include "bencode.h" #include "sdp.h" #include "str.h" @@ -52,6 +51,8 @@ #include "audio_player.h" #include "sdp.h" +#include "xt_RTPENGINE.h" + struct iterator_helper { uint64_t count; GSList *del_timeout; diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index cd0d28307..b3f83e7e6 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -31,7 +31,6 @@ #include "codec.h" #include "dtmf.h" - typedef union { const struct sdp_attr_helper *attr_helper; str_q *q; diff --git a/daemon/cdr.c b/daemon/cdr.c index 8d65c695e..5b408fbcc 100644 --- a/daemon/cdr.c +++ b/daemon/cdr.c @@ -1,6 +1,8 @@ +#include "cdr.h" + #include + #include "rtplib.h" -#include "cdr.h" #include "call.h" #include "poller.h" #include "str.h" diff --git a/daemon/cli.c b/daemon/cli.c index f8af37941..de44cd388 100644 --- a/daemon/cli.c +++ b/daemon/cli.c @@ -1,3 +1,5 @@ +#include "cli.h" + #include #include #include @@ -15,7 +17,6 @@ #include "log.h" #include "log_funcs.h" #include "call.h" -#include "cli.h" #include "socket.h" #include "redis.h" #include "control_ng.h" @@ -30,10 +31,8 @@ #include "rtplib.h" #include "ssrc.h" #include "codec.h" - #include "rtpengine_config.h" - typedef void (*cli_handler_func)(str *, struct cli_writer *); typedef struct { const char *cmd; diff --git a/daemon/codec.c b/daemon/codec.c index ef9c4415c..ba9dd843c 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -1,8 +1,10 @@ #include "codec.h" + #include #include #include #include + #include "call.h" #include "log.h" #include "rtplib.h" @@ -22,9 +24,6 @@ #include "fix_frame_channel_layout.h" #endif - - - struct codec_timer { struct timerthread_obj tt_obj; struct timeval next; diff --git a/daemon/control_tcp.c b/daemon/control_tcp.c index d29981bd3..d4295cf43 100644 --- a/daemon/control_tcp.c +++ b/daemon/control_tcp.c @@ -20,9 +20,6 @@ #include "log_funcs.h" #include "tcp_listener.h" - - - struct control_tcp { struct obj obj; diff --git a/daemon/control_udp.c b/daemon/control_udp.c index 1fd69f0c9..fad274645 100644 --- a/daemon/control_udp.c +++ b/daemon/control_udp.c @@ -20,7 +20,6 @@ #include "socket.h" #include "log_funcs.h" - static void control_udp_incoming(struct obj *obj, struct udp_buffer *udp_buf) { struct control_udp *u = (void *) obj; int ret; diff --git a/daemon/crypto.c b/daemon/crypto.c index 36af68153..e7d8697d6 100644 --- a/daemon/crypto.c +++ b/daemon/crypto.c @@ -5,8 +5,6 @@ #include #include -#include "xt_RTPENGINE.h" - #include "str.h" #include "helpers.h" #include "rtp.h" @@ -18,13 +16,10 @@ #include "ssllib.h" #include "types.h" - - +#include "xt_RTPENGINE.h" __thread GString *crypto_debug_string; - - static int aes_cm_encrypt_rtp(struct crypto_context *, struct rtp_header *, str *, uint64_t); static int aes_cm_encrypt_rtcp(struct crypto_context *, struct rtcp_packet *, str *, uint64_t); static int aes_gcm_encrypt_rtp(struct crypto_context *, struct rtp_header *, str *, uint64_t); diff --git a/daemon/dtmf.c b/daemon/dtmf.c index 6e0ede131..0f578dffa 100644 --- a/daemon/dtmf.c +++ b/daemon/dtmf.c @@ -1,5 +1,7 @@ -#include #include "dtmf.h" + +#include + #include "bencode.h" #include "control_ng.h" #include "media_socket.h" diff --git a/daemon/graphite.c b/daemon/graphite.c index 69feafe6e..b5b4cc231 100644 --- a/daemon/graphite.c +++ b/daemon/graphite.c @@ -1,9 +1,5 @@ -/* - * graphite.c - * - * Created on: Jan 19, 2015 - * Author: fmetz - */ +#include "graphite.h" + #include #include #include @@ -18,7 +14,6 @@ #include "log.h" #include "call.h" -#include "graphite.h" #include "socket.h" #include "statistics.h" #include "main.h" diff --git a/daemon/helpers.c b/daemon/helpers.c index 92d7b0499..943ba839d 100644 --- a/daemon/helpers.c +++ b/daemon/helpers.c @@ -1,4 +1,5 @@ #include "helpers.h" + #include #include #include @@ -8,20 +9,16 @@ #include #include #include + #include "log.h" #include "main.h" - - #if 0 #define BSDB(x...) fprintf(stderr, x) #else #define BSDB(x...) ((void)0) #endif - - - struct detach_thread { void (*func)(void *); void *data; diff --git a/daemon/homer.c b/daemon/homer.c index 9f9419b54..411b9cb0e 100644 --- a/daemon/homer.c +++ b/daemon/homer.c @@ -14,14 +14,8 @@ #include "str.h" #include "types.h" - - - #define SEND_QUEUE_LIMIT 200 - - - TYPED_GQUEUE(gstring, GString) struct homer_sender { diff --git a/daemon/ice.c b/daemon/ice.c index 20b59be41..f565958f2 100644 --- a/daemon/ice.c +++ b/daemon/ice.c @@ -1,7 +1,9 @@ #include "ice.h" + #include #include #include + #include "str.h" #include "call.h" #include "helpers.h" @@ -13,8 +15,6 @@ #include "timerthread.h" #include "call_interfaces.h" - - #if __DEBUG #define ICE_DEBUG 1 #else @@ -27,18 +27,12 @@ #define __DBG(x...) ilogs(internals, LOG_DEBUG, x) #endif - - - #define PAIR_FORMAT STR_FORMAT_M ":" STR_FORMAT_M ":%lu" #define PAIR_FMT(p) \ STR_FMT_M(&(p)->local_intf->ice_foundation), \ STR_FMT_M(&(p)->remote_candidate->foundation), \ (p)->remote_candidate->component_id - - - struct fragment_key { str call_id; str from_tag; diff --git a/daemon/janus.c b/daemon/janus.c index 8434299fe..3e29b8807 100644 --- a/daemon/janus.c +++ b/daemon/janus.c @@ -1,6 +1,8 @@ #include "janus.h" + #include #include + #include "websocket.h" #include "log.h" #include "main.h" @@ -11,7 +13,6 @@ #include "rtplib.h" #include "ice.h" - TYPED_GHASHTABLE(janus_handles_set, uint64_t, void, g_int64_hash, g_int64_equal, NULL, NULL) TYPED_GHASHTABLE(janus_websockets_ht, struct websocket_conn, struct websocket_conn, g_direct_hash, g_direct_equal, NULL, NULL) diff --git a/daemon/jitter_buffer.c b/daemon/jitter_buffer.c index 58866c495..b36388a3c 100644 --- a/daemon/jitter_buffer.c +++ b/daemon/jitter_buffer.c @@ -1,12 +1,14 @@ #include "jitter_buffer.h" + +#include +#include + #include "timerthread.h" #include "media_socket.h" #include "call.h" #include "codec.h" #include "main.h" #include "rtcplib.h" -#include -#include #define INITIAL_PACKETS 0x1E #define CONT_SEQ_COUNT 0x1F4 diff --git a/daemon/kernel.c b/daemon/kernel.c index 1a8b82f79..b0443c6db 100644 --- a/daemon/kernel.c +++ b/daemon/kernel.c @@ -9,25 +9,15 @@ #include #include -#include "xt_RTPENGINE.h" - #include "helpers.h" #include "log.h" - - +#include "xt_RTPENGINE.h" #define PREFIX "/proc/rtpengine" - - - struct kernel_interface kernel; - - - - static int kernel_action_table(const char *action, unsigned int id) { char s[64]; int saved_errno; diff --git a/daemon/load.c b/daemon/load.c index c8c5c07c0..11fdb7752 100644 --- a/daemon/load.c +++ b/daemon/load.c @@ -1,10 +1,12 @@ #include "load.h" + #include #include #include #include #include #include + #include "helpers.h" #include "log.h" #include "main.h" diff --git a/daemon/log.c b/daemon/log.c index c896220a4..182a975c4 100644 --- a/daemon/log.c +++ b/daemon/log.c @@ -1,8 +1,10 @@ #include "log.h" + #include #include #include #include + #include "str.h" #include "call.h" #include "poller.h" @@ -10,9 +12,6 @@ #include "loglib.h" #include "main.h" - - - __thread struct log_info log_info; __thread GSList *log_info_stack; diff --git a/daemon/media_player.c b/daemon/media_player.c index 2b3d68a0e..52ab9fb4d 100644 --- a/daemon/media_player.c +++ b/daemon/media_player.c @@ -1,9 +1,11 @@ #include "media_player.h" + #include #ifdef WITH_TRANSCODING #include #include #endif + #include "obj.h" #include "log.h" #include "timerthread.h" @@ -21,12 +23,8 @@ #endif #include "kernel.h" - - #define DEFAULT_AVIO_BUFSIZE 4096 - - #ifdef WITH_TRANSCODING static struct timerthread media_player_thread; static __thread MYSQL *mysql_conn; diff --git a/daemon/media_socket.c b/daemon/media_socket.c index b898bcc3d..34e4d56bd 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -1,9 +1,11 @@ #include "media_socket.h" + #include #include #include #include #include + #include "str.h" #include "ice.h" #include "socket.h" @@ -12,7 +14,6 @@ #include "ice.h" #include "stun.h" #include "kernel.h" -#include "xt_RTPENGINE.h" #include "rtcp.h" #include "sdp.h" #include "helpers.h" @@ -31,6 +32,7 @@ #include "mqtt.h" #include "janus.h" +#include "xt_RTPENGINE.h" #ifndef PORT_RANDOM_MIN #define PORT_RANDOM_MIN 6 diff --git a/daemon/mqtt.c b/daemon/mqtt.c index 33bdaa92e..e31e697b0 100644 --- a/daemon/mqtt.c +++ b/daemon/mqtt.c @@ -1,6 +1,7 @@ #ifdef HAVE_MQTT #include "mqtt.h" + #include #include #include @@ -8,6 +9,7 @@ #include #include #include + #include "main.h" #include "log.h" #include "log_funcs.h" diff --git a/daemon/nftables.c b/daemon/nftables.c index ab24a254e..43e9e7188 100644 --- a/daemon/nftables.c +++ b/daemon/nftables.c @@ -17,12 +17,9 @@ #include #include -#include "xt_RTPENGINE.h" - #include "helpers.h" - - +#include "xt_RTPENGINE.h" struct iterate_callbacks { // called for each expression diff --git a/daemon/recording.c b/daemon/recording.c index 05118f081..f9498e830 100644 --- a/daemon/recording.c +++ b/daemon/recording.c @@ -1,4 +1,5 @@ #include "recording.h" + #include #include #include @@ -13,8 +14,6 @@ #include #include -#include "xt_RTPENGINE.h" - #include "call.h" #include "kernel.h" #include "bencode.h" @@ -23,7 +22,7 @@ #include "log.h" #include "call_interfaces.h" - +#include "xt_RTPENGINE.h" struct rec_pcap_format { int linktype; diff --git a/daemon/redis.c b/daemon/redis.c index 13addc970..0e5a990aa 100644 --- a/daemon/redis.c +++ b/daemon/redis.c @@ -34,7 +34,6 @@ #include "main.h" #include "codec.h" - typedef union { GQueue *q; stream_fd_q *sfds_q; diff --git a/daemon/rtcp.c b/daemon/rtcp.c index 2d30544b7..a32dea131 100644 --- a/daemon/rtcp.c +++ b/daemon/rtcp.c @@ -18,8 +18,6 @@ #include "sdp.h" #include "log_funcs.h" - - /* This toggles between two different and incompatible interpretations of * RFC 3711, namely sections 4.3.2 and 4.3.1. * See http://www.ietf.org/mail-archive/web/avt/current/msg06124.html diff --git a/daemon/rtp.c b/daemon/rtp.c index 95cd5b2ee..f5e759982 100644 --- a/daemon/rtp.c +++ b/daemon/rtp.c @@ -12,9 +12,6 @@ #include "ssrc.h" #include "call.h" - - - INLINE int check_session_keys(struct crypto_context *c) { str s; const char *err; diff --git a/daemon/ssrc.c b/daemon/ssrc.c index a71397435..b23cad4ff 100644 --- a/daemon/ssrc.c +++ b/daemon/ssrc.c @@ -1,12 +1,12 @@ #include "ssrc.h" + #include + #include "helpers.h" #include "call.h" #include "rtplib.h" #include "codeclib.h" - - static void __free_ssrc_entry_call(void *e); diff --git a/daemon/statistics.c b/daemon/statistics.c index 3ea456b48..7509862af 100644 --- a/daemon/statistics.c +++ b/daemon/statistics.c @@ -1,12 +1,13 @@ +#include "statistics.h" + #include #include + #include "call.h" -#include "statistics.h" #include "graphite.h" #include "main.h" #include "control_ng.h" - struct timeval rtpe_started; diff --git a/daemon/stun.c b/daemon/stun.c index e0e9c8411..daeed0530 100644 --- a/daemon/stun.c +++ b/daemon/stun.c @@ -15,8 +15,6 @@ #include "ice.h" #include "ssllib.h" - - #define STUN_CRC_XOR 0x5354554eUL #define STUN_USERNAME 0x0006 diff --git a/daemon/t38.c b/daemon/t38.c index 4a46c6f96..c934a6674 100644 --- a/daemon/t38.c +++ b/daemon/t38.c @@ -1,10 +1,6 @@ #include "t38.h" - - #ifdef WITH_TRANSCODING - - #include #include #include diff --git a/daemon/timerthread.c b/daemon/timerthread.c index 5650a7cf2..aedae255f 100644 --- a/daemon/timerthread.c +++ b/daemon/timerthread.c @@ -1,4 +1,5 @@ #include "timerthread.h" + #include "helpers.h" #include "log_funcs.h" diff --git a/daemon/websocket.c b/daemon/websocket.c index 2578f656f..ab1c935a5 100644 --- a/daemon/websocket.c +++ b/daemon/websocket.c @@ -1,7 +1,9 @@ #include "websocket.h" + #include #include #include + #include "log.h" #include "main.h" #include "str.h"