Change in osmo-sgsn[master]: gb_proxy: cosmetic: Use 'bool' in data structures where applicable
Harald Welte has posted comments on this change. ( https://gerrit.osmocom.org/13762 ) Change subject: gb_proxy: cosmetic: Use 'bool' in data structures where applicable .. Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/13762 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I63876f52d5de87e4c99d92669270fd1f487e217c Gerrit-Change-Number: 13762 Gerrit-PatchSet: 4 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Comment-Date: Thu, 25 Apr 2019 20:00:23 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-sgsn[master]: gb_proxy: cosmetic: Use 'bool' in data structures where applicable
Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/13762 ) Change subject: gb_proxy: cosmetic: Use 'bool' in data structures where applicable .. gb_proxy: cosmetic: Use 'bool' in data structures where applicable If we ever only use 0/1 in an 'int', we should have used 'bool'. Change-Id: I63876f52d5de87e4c99d92669270fd1f487e217c --- M include/osmocom/sgsn/gb_proxy.h M src/gprs/gb_proxy.c M src/gprs/gb_proxy_patch.c M src/gprs/gb_proxy_tlli.c M src/gprs/gb_proxy_vty.c 5 files changed, 36 insertions(+), 35 deletions(-) Approvals: Jenkins Builder: Verified Harald Welte: Looks good to me, approved Pau Espin Pedrol: Looks good to me, approved diff --git a/include/osmocom/sgsn/gb_proxy.h b/include/osmocom/sgsn/gb_proxy.h index a3e1a02..1e8fb25 100644 --- a/include/osmocom/sgsn/gb_proxy.h +++ b/include/osmocom/sgsn/gb_proxy.h @@ -10,6 +10,7 @@ #include #include +#include #define GBPROXY_INIT_VU_GEN_TX 256 @@ -83,7 +84,7 @@ }; struct gbproxy_match { - int enable; /* is this match enabled? */ + bool enable; /* is this match enabled? */ char *re_str; /* regular expression (for IMSI) in string format */ regex_t re_comp;/* compiled regular expression (for IMSI) */ }; @@ -119,11 +120,11 @@ uint32_t stored_msgs_max_len; /* Should the P-TMSI be patched on the fly (required for 2-SGSN config) */ - int patch_ptmsi; + bool patch_ptmsi; /* Should the IMSI be acquired by the proxy (required for 2-SGSN config) */ - int acquire_imsi; + bool acquire_imsi; /* Should we route subscribers to two different SGSNs? */ - int route_to_sgsn2; + bool route_to_sgsn2; /* NSEI of the second SGSN */ uint16_t nsip_sgsn2_nsei; /* should we keep a cache of per-subscriber state even after de-registration? */ @@ -154,7 +155,7 @@ /* BVCI used for Point-to-Point to this peer */ uint16_t bvci; - int blocked; + bool blocked; /* Routeing Area that this peer is part of (raw 04.08 encoding) */ uint8_t ra[6]; @@ -175,9 +176,9 @@ /* newly-assigned TLLI (e.g. during P-TMSI allocation procedure) */ uint32_t assigned; /* has the BSS side validated (confirmed) the new TLLI? */ - int bss_validated; + bool bss_validated; /* has the SGSN side validated (confirmed) the new TLLI? */ - int net_validated; + bool net_validated; /* NOTE: once both are validated, we set current = assigned and assigned = 0 */ /* The P-TMSI for this subscriber */ @@ -204,7 +205,7 @@ size_t imsi_len; /* is the IMSI acquisition still pending? */ - int imsi_acq_pending; + bool imsi_acq_pending; /* queue of stored UL messages (until IMSI acquisition completes and we can * determine which of the SGSNs we should route this to */ @@ -215,10 +216,10 @@ unsigned vu_gen_tx_bss; /* is this subscriber deregistered (TLLI invalidated)? */ - int is_deregistered; + bool is_deregistered; /* does this link match either the (2-SGSN) routing or the patching rule? */ - int is_matching[GBPROX_MATCH_LAST]; + bool is_matching[GBPROX_MATCH_LAST]; }; diff --git a/src/gprs/gb_proxy.c b/src/gprs/gb_proxy.c index 0b5758a..3da7bfd 100644 --- a/src/gprs/gb_proxy.c +++ b/src/gprs/gb_proxy.c @@ -310,7 +310,7 @@ in_progress = 1; gbproxy_link_info_discard_messages(link_info); - link_info->imsi_acq_pending = 0; + link_info->imsi_acq_pending = false; return in_progress; } @@ -531,7 +531,7 @@ * implementation relies on the MS doing proper retransmissions * of the triggering message instead */ - link_info->imsi_acq_pending = 1; + link_info->imsi_acq_pending = true; } return 0; @@ -836,11 +836,11 @@ switch (pdu_type) { case BSSGP_PDUT_BVC_BLOCK_ACK: - peer->blocked = 1; + peer->blocked = true; rate_ctr_inc(>ctrg->ctr[GBPROX_PEER_CTR_BLOCKED]); break; case BSSGP_PDUT_BVC_UNBLOCK_ACK: - peer->blocked = 0; + peer->blocked = false; rate_ctr_inc(>ctrg->ctr[GBPROX_PEER_CTR_UNBLOCKED]); break; default: diff --git a/src/gprs/gb_proxy_patch.c b/src/gprs/gb_proxy_patch.c index 251bb67..6235b04 100644 --- a/src/gprs/gb_proxy_patch.c +++ b/src/gprs/gb_proxy_patch.c @@ -398,7 +398,7 @@ { if (match->enable) { regfree(>re_comp); - match->enable = 0; + match->enable = false; } talloc_free(match->re_str); match->re_str = NULL; @@ -419,7 +419,7 @@ REG_EXTENDED |
Change in osmo-sgsn[master]: gb_proxy: cosmetic: Use 'bool' in data structures where applicable
Pau Espin Pedrol has posted comments on this change. ( https://gerrit.osmocom.org/13762 ) Change subject: gb_proxy: cosmetic: Use 'bool' in data structures where applicable .. Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/13762 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I63876f52d5de87e4c99d92669270fd1f487e217c Gerrit-Change-Number: 13762 Gerrit-PatchSet: 1 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Pau Espin Pedrol Gerrit-CC: Jenkins Builder (102) Gerrit-Comment-Date: Tue, 23 Apr 2019 20:58:02 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-sgsn[master]: gb_proxy: cosmetic: Use 'bool' in data structures where applicable
Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/13762 Change subject: gb_proxy: cosmetic: Use 'bool' in data structures where applicable .. gb_proxy: cosmetic: Use 'bool' in data structures where applicable If we ever only use 0/1 in an 'int', we should have used 'bool'. Change-Id: I63876f52d5de87e4c99d92669270fd1f487e217c --- M include/osmocom/sgsn/gb_proxy.h M src/gprs/gb_proxy.c M src/gprs/gb_proxy_patch.c M src/gprs/gb_proxy_tlli.c M src/gprs/gb_proxy_vty.c 5 files changed, 36 insertions(+), 35 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/62/13762/1 diff --git a/include/osmocom/sgsn/gb_proxy.h b/include/osmocom/sgsn/gb_proxy.h index 740579f..ff247d8 100644 --- a/include/osmocom/sgsn/gb_proxy.h +++ b/include/osmocom/sgsn/gb_proxy.h @@ -10,6 +10,7 @@ #include #include +#include #define GBPROXY_INIT_VU_GEN_TX 256 @@ -83,7 +84,7 @@ }; struct gbproxy_match { - int enable; /* is this match enabled? */ + bool enable; /* is this match enabled? */ char *re_str; /* regular expression (for IMSI) in string format */ regex_t re_comp;/* compiled regular expression (for IMSI) */ }; @@ -119,11 +120,11 @@ uint32_t stored_msgs_max_len; /* Should the P-TMSI be patched on the fly (required for 2-SGSN config) */ - int patch_ptmsi; + bool patch_ptmsi; /* Should the IMSI be acquired by the proxy (required for 2-SGSN config) */ - int acquire_imsi; + bool acquire_imsi; /* Should we route subscribers to two different SGSNs? */ - int route_to_sgsn2; + bool route_to_sgsn2; /* NSEI of the second SGSN */ uint16_t nsip_sgsn2_nsei; /* should we keep per-subscriber state even after de-registration? */ @@ -154,7 +155,7 @@ /* BVCI used for Point-to-Point to this peer */ uint16_t bvci; - int blocked; + bool blocked; /* Routeing Area that this peer is part of (raw 04.08 encoding) */ uint8_t ra[6]; @@ -175,9 +176,9 @@ /* newly-assigned TLLI (e.g. during P-TMSI allocation procedure) */ uint32_t assigned; /* has the BSS side validated (confirmed) the new TLLI? */ - int bss_validated; + bool bss_validated; /* has the SGSN side validated (confirmed) the new TLLI? */ - int net_validated; + bool net_validated; /* NOTE: once both are validated, we set current = assigned and assigned = 0 */ /* The P-TMSI for this subscriber */ @@ -204,7 +205,7 @@ size_t imsi_len; /* is the IMSI acquisition still pending? */ - int imsi_acq_pending; + bool imsi_acq_pending; /* queue of stored UL messages (until IMSI acquisition completes and we can * determine which of the SGSNs we should route this to */ @@ -215,10 +216,10 @@ unsigned vu_gen_tx_bss; /* is this subscriber deregistered (TLLI invalidated)? */ - int is_deregistered; + bool is_deregistered; /* does this link match either the (2-SGSN) routing or the patching rule? */ - int is_matching[GBPROX_MATCH_LAST]; + bool is_matching[GBPROX_MATCH_LAST]; }; diff --git a/src/gprs/gb_proxy.c b/src/gprs/gb_proxy.c index 0b5758a..3da7bfd 100644 --- a/src/gprs/gb_proxy.c +++ b/src/gprs/gb_proxy.c @@ -310,7 +310,7 @@ in_progress = 1; gbproxy_link_info_discard_messages(link_info); - link_info->imsi_acq_pending = 0; + link_info->imsi_acq_pending = false; return in_progress; } @@ -531,7 +531,7 @@ * implementation relies on the MS doing proper retransmissions * of the triggering message instead */ - link_info->imsi_acq_pending = 1; + link_info->imsi_acq_pending = true; } return 0; @@ -836,11 +836,11 @@ switch (pdu_type) { case BSSGP_PDUT_BVC_BLOCK_ACK: - peer->blocked = 1; + peer->blocked = true; rate_ctr_inc(>ctrg->ctr[GBPROX_PEER_CTR_BLOCKED]); break; case BSSGP_PDUT_BVC_UNBLOCK_ACK: - peer->blocked = 0; + peer->blocked = false; rate_ctr_inc(>ctrg->ctr[GBPROX_PEER_CTR_UNBLOCKED]); break; default: diff --git a/src/gprs/gb_proxy_patch.c b/src/gprs/gb_proxy_patch.c index 251bb67..6235b04 100644 --- a/src/gprs/gb_proxy_patch.c +++ b/src/gprs/gb_proxy_patch.c @@ -398,7 +398,7 @@ { if (match->enable) { regfree(>re_comp); - match->enable = 0; + match->enable = false; } talloc_free(match->re_str); match->re_str = NULL; @@ -419,7 +419,7 @@ REG_EXTENDED | REG_NOSUB | REG_ICASE); if (rc == 0) { -