From 757285bf259920f36a4967a3cc6db879808aad71 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Mon, 14 Feb 2022 12:11:04 +0100 Subject: [PATCH] Fix trailing whitespace (#1365) * [SMF] Fix trailing whitespace * [CORE] Fix trailing whitespace * [GTP] Fix trailing whitespace --- lib/core/ogs-3gpp-types.h | 16 +++++------ lib/gtp/types.h | 26 +++++++++--------- src/smf/event.c | 6 ++--- src/smf/gx-path.c | 56 +++++++++++++++++++-------------------- src/smf/smf-sm.c | 2 +- 5 files changed, 53 insertions(+), 53 deletions(-) diff --git a/lib/core/ogs-3gpp-types.h b/lib/core/ogs-3gpp-types.h index 5dd554c4f..bab4d3fe6 100644 --- a/lib/core/ogs-3gpp-types.h +++ b/lib/core/ogs-3gpp-types.h @@ -121,7 +121,7 @@ uint16_t ogs_plmn_id_mcc(ogs_plmn_id_t *plmn_id); uint16_t ogs_plmn_id_mnc(ogs_plmn_id_t *plmn_id); uint16_t ogs_plmn_id_mnc_len(ogs_plmn_id_t *plmn_id); -void *ogs_plmn_id_build(ogs_plmn_id_t *plmn_id, +void *ogs_plmn_id_build(ogs_plmn_id_t *plmn_id, uint16_t mcc, uint16_t mnc, uint16_t mnc_len); char *ogs_serving_network_name_from_plmn_id(ogs_plmn_id_t *plmn_id); @@ -265,7 +265,7 @@ ED2(uint8_t spare:5;, uint8_t session_type:3;) union { /* PDU_SESSION_TYPE_IPV4 */ - uint32_t addr; + uint32_t addr; /* PDU_SESSION_TYPE_IPV6 */ struct { @@ -283,7 +283,7 @@ ED2(uint8_t spare:5;, /* IPv6 Prefix and Interface Identifier */ uint8_t addr6[OGS_IPV6_LEN]; }; - uint32_t addr; + uint32_t addr; } __attribute__ ((packed)) both; }; } __attribute__ ((packed)) ogs_paa_t; @@ -305,8 +305,8 @@ typedef struct ogs_qos_s { struct { /* Values 1 to 8 should only be assigned for services that are - * authorized to receive prioritized treatment within an operator domain. - * Values 9 to 15 may be assigned to resources that are authorized + * authorized to receive prioritized treatment within an operator domain. + * Values 9 to 15 may be assigned to resources that are authorized * by the home network and thus applicable when a UE is roaming. */ uint8_t priority_level; /* @@ -370,7 +370,7 @@ typedef struct ogs_pcc_rule_s { int flow_status; uint32_t precedence; - + ogs_qos_t qos; } ogs_pcc_rule_t; @@ -453,8 +453,8 @@ int ogs_fqdn_parse(char *dst, char *src, int len); /************************************************** * Protocol Configuration Options Structure - * 8.13 Protocol Configuration Options (PCO) - * 10.5.6.3 Protocol configuration options in 3GPP TS 24.008 + * 8.13 Protocol Configuration Options (PCO) + * 10.5.6.3 Protocol configuration options in 3GPP TS 24.008 * RFC 3232 [103] * RFC 1661 [102] */ #define OGS_PCO_PPP_FOR_USE_WITH_IP_PDP_TYPE_OR_IP_PDN_TYPE 0 diff --git a/lib/gtp/types.h b/lib/gtp/types.h index 6ddad2851..902b1bc17 100644 --- a/lib/gtp/types.h +++ b/lib/gtp/types.h @@ -246,8 +246,8 @@ ED8(uint8_t spare1:1;, uint8_t emergency_pdu_session_indication:1;) } __attribute__ ((packed)) ogs_gtp_indication_t; -/* 8.13 Protocol Configuration Options (PCO) - * 10.5.6.3 Protocol configuration options in 3GPP TS 24.008 +/* 8.13 Protocol Configuration Options (PCO) + * 10.5.6.3 Protocol configuration options in 3GPP TS 24.008 * RFC 3232 [103] * RFC 1661 [102] */ @@ -256,9 +256,9 @@ ED8(uint8_t spare1:1;, typedef struct ogs_gtp_bearer_qos_s { ED5(uint8_t spare1:1;, /* See 3GPP TS 29.212[29], clause 5.3.46 Pre-emption-Capability AVP. */ - uint8_t pre_emption_capability:1;, - /* See 3GPP TS 29.212[29], clause 5.3.45 Priority-Level AVP. - * PL encodes each priority level defined for the Priority-Level AVP + uint8_t pre_emption_capability:1;, + /* See 3GPP TS 29.212[29], clause 5.3.45 Priority-Level AVP. + * PL encodes each priority level defined for the Priority-Level AVP * as the binary value of the priority level. */ uint8_t priority_level:4;, uint8_t spare2:1;, @@ -272,7 +272,7 @@ ED5(uint8_t spare1:1;, uint64_t ul_gbr; uint64_t dl_gbr; - /* NOTE : The encoding in 3GPP TS 24.301 [23] and 3GPP TS 36.413 [10] + /* NOTE : The encoding in 3GPP TS 24.301 [23] and 3GPP TS 36.413 [10] * is different from the encoding within this specification. */ } __attribute__ ((packed)) ogs_gtp_bearer_qos_t; @@ -292,7 +292,7 @@ typedef struct ogs_gtp_flow_qos_s { uint64_t ul_gbr; uint64_t dl_gbr; - /* NOTE : The encoding in 3GPP TS 24.301 [23] and 3GPP TS 36.413 [10] + /* NOTE : The encoding in 3GPP TS 24.301 [23] and 3GPP TS 36.413 [10] * is different from the encoding within this specification. */ } __attribute__ ((packed)) ogs_gtp_flow_qos_t; @@ -316,7 +316,7 @@ int16_t ogs_gtp_build_flow_qos(ogs_tlv_octet_t *octet, #define OGS_GTP_RAT_TYPE_VIRTUAL 7 #define OGS_GTP_RAT_TYPE_EUTRAN_NB_IOT 8 -/* 8.19 EPS Bearer Level Traffic Flow Template (Bearer TFT) +/* 8.19 EPS Bearer Level Traffic Flow Template (Bearer TFT) * See subclause 10.5.6.12 in 3GPP TS 24.008 [13]. */ #define OGS_GTP_MAX_TRAFFIC_FLOW_TEMPLATE 255 @@ -482,15 +482,15 @@ ED3(uint8_t ipv4:1;, #define OGS_GTP_UE_TIME_ZONE_1_HOUR_FOR_DAYLIGHT_SAVING_TIME 1 #define OGS_GTP_UE_TIME_ZONE_2_HOUR_FOR_DAYLIGHT_SAVING_TIME 2 /* Time Zone" IE in 3GPP TS 24.008 [5]. - * This field uses the same format as the Timezone field used in the - * TP-Service-Centre-Time-Stamp, which is defined in 3GPP TS 23.040 [90], + * This field uses the same format as the Timezone field used in the + * TP-Service-Centre-Time-Stamp, which is defined in 3GPP TS 23.040 [90], * and its value shall be set as defined in 3GPP TS 22.042 */ typedef struct ogs_gtp_ue_timezone_s { #define OGS_GTP_TIME_TO_BCD(x) OGS_TIME_TO_BCD(x) /* The Time Zone indicates the difference, expressed in quarters of an hour, - * between the local time and GMT. In the first of the two semi-octets, - * the first bit (bit 3 of the seventh octet of - * the TP-Service-Centre-Time-Stamp field) represents + * between the local time and GMT. In the first of the two semi-octets, + * the first bit (bit 3 of the seventh octet of + * the TP-Service-Centre-Time-Stamp field) represents * the algebraic sign of this difference (0: positive, 1: negative). */ uint8_t timezone; ED2(uint8_t spare:6;, diff --git a/src/smf/event.c b/src/smf/event.c index 6360eabd4..98344d13c 100644 --- a/src/smf/event.c +++ b/src/smf/event.c @@ -57,9 +57,9 @@ const char *smf_event_get_name(smf_event_t *e) return OGS_FSM_NAME_INIT_SIG; switch (e->id) { - case OGS_FSM_ENTRY_SIG: + case OGS_FSM_ENTRY_SIG: return OGS_FSM_NAME_ENTRY_SIG; - case OGS_FSM_EXIT_SIG: + case OGS_FSM_EXIT_SIG: return OGS_FSM_NAME_EXIT_SIG; case SMF_EVT_S5C_MESSAGE: @@ -90,7 +90,7 @@ const char *smf_event_get_name(smf_event_t *e) case SMF_EVT_5GSM_TIMER: return "SMF_EVT_5GSM_TIMER"; - default: + default: break; } diff --git a/src/smf/gx-path.c b/src/smf/gx-path.c index 61628a6ac..95229355a 100644 --- a/src/smf/gx-path.c +++ b/src/smf/gx-path.c @@ -20,8 +20,8 @@ #include "fd-path.h" static struct session_handler *smf_gx_reg = NULL; -static struct disp_hdl *hdl_gx_fb = NULL; -static struct disp_hdl *hdl_gx_rar = NULL; +static struct disp_hdl *hdl_gx_fb = NULL; +static struct disp_hdl *hdl_gx_rar = NULL; struct sess_state { os0_t gx_sid; /* Gx Session-Id */ @@ -118,7 +118,7 @@ void smf_gx_send_ccr(smf_sess_t *sess, ogs_gtp_xact_t *xact, } else { /* Create a new session */ #define OGS_DIAM_GX_APP_SID_OPT "app_gx" - ret = fd_msg_new_session(req, (os0_t)OGS_DIAM_GX_APP_SID_OPT, + ret = fd_msg_new_session(req, (os0_t)OGS_DIAM_GX_APP_SID_OPT, CONSTSTRLEN(OGS_DIAM_GX_APP_SID_OPT)); ogs_assert(ret == 0); ret = fd_msg_sess_get(fd_g_config->cnf_dict, req, &session, NULL); @@ -146,7 +146,7 @@ void smf_gx_send_ccr(smf_sess_t *sess, ogs_gtp_xact_t *xact, } else ogs_debug(" Retrieve session: [%s]", sess_data->gx_sid); - /* + /* * 8.2. CC-Request-Number AVP * * The CC-Request-Number AVP (AVP Code 415) is of type Unsigned32 and @@ -167,7 +167,7 @@ void smf_gx_send_ccr(smf_sess_t *sess, ogs_gtp_xact_t *xact, else sess_data->cc_request_number++; - ogs_debug(" CC Request Type[%d] Number[%d]", + ogs_debug(" CC Request Type[%d] Number[%d]", sess_data->cc_request_type, sess_data->cc_request_number); ogs_assert(sess_data->cc_request_number <= MAX_CC_REQUEST_NUMBER); @@ -178,7 +178,7 @@ void smf_gx_send_ccr(smf_sess_t *sess, ogs_gtp_xact_t *xact, /* Set Origin-Host & Origin-Realm */ ret = fd_msg_add_origin(req, 0); ogs_assert(ret == 0); - + /* Set the Destination-Realm AVP */ ret = fd_msg_avp_new(ogs_diam_destination_realm, 0, &avp); ogs_assert(ret == 0); @@ -298,7 +298,7 @@ void smf_gx_send_ccr(smf_sess_t *sess, ogs_gtp_xact_t *xact, ogs_assert(ret == 0); memcpy(&paa, &sess->session.paa, OGS_PAA_IPV6_LEN); #define FRAMED_IPV6_PREFIX_LENGTH 128 /* from spec document */ - paa.len = FRAMED_IPV6_PREFIX_LENGTH; + paa.len = FRAMED_IPV6_PREFIX_LENGTH; val.os.data = (uint8_t*)&paa; val.os.len = OGS_PAA_IPV6_LEN; ret = fd_msg_avp_setvalue(avp, &val); @@ -364,7 +364,7 @@ void smf_gx_send_ccr(smf_sess_t *sess, ogs_gtp_xact_t *xact, ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); ogs_assert(ret == 0); } - + if (sess->session.ambr.downlink) { ret = fd_msg_avp_new( ogs_diam_gx_apn_aggregate_max_bitrate_dl, 0, &avpch1); @@ -595,18 +595,18 @@ void smf_gx_send_ccr(smf_sess_t *sess, ogs_gtp_xact_t *xact, ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); ogs_assert(ret == 0); } - + ret = clock_gettime(CLOCK_REALTIME, &sess_data->ts); - - /* Keep a pointer to the session data for debug purpose, + + /* Keep a pointer to the session data for debug purpose, * in real life we would not need it */ svg = sess_data; - + /* Store this value in the session */ ret = fd_sess_state_store(smf_gx_reg, session, &sess_data); ogs_assert(ret == 0); ogs_assert(sess_data == NULL); - + /* Send the request */ ret = fd_msg_send(&req, smf_gx_cca_cb, svg); ogs_assert(ret == 0); @@ -640,7 +640,7 @@ static void smf_gx_cca_cb(void *data, struct msg **msg) uint32_t cc_request_number = 0; ogs_debug("[Credit-Control-Answer]"); - + ret = clock_gettime(CLOCK_REALTIME, &ts); ogs_assert(ret == 0); @@ -650,7 +650,7 @@ static void smf_gx_cca_cb(void *data, struct msg **msg) ogs_assert(new == 0); ogs_debug(" Search the session"); - + ret = fd_sess_state_retrieve(smf_gx_reg, session, &sess_data); ogs_assert(ret == 0); ogs_assert(sess_data); @@ -688,7 +688,7 @@ static void smf_gx_cca_cb(void *data, struct msg **msg) /* Set Credit Control Command */ memset(gx_message, 0, gxbuf_len); gx_message->cmd_code = OGS_DIAM_GX_CMD_CODE_CREDIT_CONTROL; - + /* Value of Result Code */ ret = fd_msg_search_avp(*msg, ogs_diam_result_code, &avp); ogs_assert(ret == 0); @@ -957,11 +957,11 @@ out: /* Free the message */ ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); - dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + + dur = ((ts.tv_sec - sess_data->ts.tv_sec) * 1000000) + ((ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); if (ogs_diam_logger_self()->stats.nb_recv) { /* Ponderate in the avg */ - ogs_diam_logger_self()->stats.avg = (ogs_diam_logger_self()->stats.avg * + ogs_diam_logger_self()->stats.avg = (ogs_diam_logger_self()->stats.avg * ogs_diam_logger_self()->stats.nb_recv + dur) / (ogs_diam_logger_self()->stats.nb_recv + 1); /* Min, max */ @@ -976,22 +976,22 @@ out: } if (error) ogs_diam_logger_self()->stats.nb_errs++; - else + else ogs_diam_logger_self()->stats.nb_recv++; ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); - + /* Display how long it took */ if (ts.tv_nsec > sess_data->ts.tv_nsec) - ogs_trace("in %d.%06ld sec", + ogs_trace("in %d.%06ld sec", (int)(ts.tv_sec - sess_data->ts.tv_sec), (long)(ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); else - ogs_trace("in %d.%06ld sec", + ogs_trace("in %d.%06ld sec", (int)(ts.tv_sec + 1 - sess_data->ts.tv_sec), (long)(1000000000 + ts.tv_nsec - sess_data->ts.tv_nsec) / 1000); - ogs_debug(" CC-Request-Type[%d] Number[%d] in Session Data", + ogs_debug(" CC-Request-Type[%d] Number[%d] in Session Data", sess_data->cc_request_type, sess_data->cc_request_number); ogs_debug(" Current CC-Request-Number[%d]", cc_request_number); if (sess_data->cc_request_type == @@ -1009,20 +1009,20 @@ out: ret = fd_msg_free(*msg); ogs_assert(ret == 0); *msg = NULL; - + return; } -static int smf_gx_fb_cb(struct msg **msg, struct avp *avp, +static int smf_gx_fb_cb(struct msg **msg, struct avp *avp, struct session *sess, void *opaque, enum disp_action *act) { /* This CB should never be called */ ogs_warn("Unexpected message received!"); - + return ENOTSUP; } -static int smf_gx_rar_cb( struct msg **msg, struct avp *avp, +static int smf_gx_rar_cb( struct msg **msg, struct avp *avp, struct session *session, void *opaque, enum disp_action *act) { int rv; @@ -1042,7 +1042,7 @@ static int smf_gx_rar_cb( struct msg **msg, struct avp *avp, uint32_t result_code = OGS_DIAM_UNKNOWN_SESSION_ID; int error = 0; - + ogs_assert(msg); ogs_debug("Re-Auth-Request"); diff --git a/src/smf/smf-sm.c b/src/smf/smf-sm.c index 677e2d642..81ed433a1 100644 --- a/src/smf/smf-sm.c +++ b/src/smf/smf-sm.c @@ -527,7 +527,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e) ogs_assert_if_reached(); END break; - + DEFAULT ogs_error("Invalid resource name [%s]", sbi_message.h.resource.component[0]);