osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/36791?usp=email )
Change subject: gtp: move conversion functions up
......................................................................
gtp: move conversion functions up
Move the conversion functions above the first user, so we can make
in_addr2gsna static in a follow-up commit and remove the extra
declaration.
Change-Id: I51e6a7c1161320fc54b0e8197ae57e4327976eb1
---
M gtp/gtp.c
1 file changed, 47 insertions(+), 34 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
diff --git a/gtp/gtp.c b/gtp/gtp.c
index 9442b33..482875d 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -823,6 +823,40 @@
}
/* ***********************************************************
+ * Conversion functions
+ *************************************************************/
+
+/* ***********************************************************
+ * IP address conversion functions
+ * There exist several types of address representations:
+ * - eua: End User Address. (29.060, 7.7.27, message type 128)
+ * Used for signalling address to mobile station. Supports IPv4
+ * IPv6 x.25 etc. etc.
+ * - gsna: GSN Address. (29.060, 7.7.32, message type 133): IP address
+ * of GSN. If length is 4 it is IPv4. If length is 16 it is IPv6.
+ * - in_addr: IPv4 address struct.
+ * - sockaddr_in: Socket API representation of IP address and
+ * port number.
+ *************************************************************/
+
+int gsna2in_addr(struct in_addr *dst, struct ul16_t *gsna)
+{
+ memset(dst, 0, sizeof(struct in_addr));
+ if (gsna->l != 4)
+ return EOF; /* Return if not IPv4 */
+ memcpy(dst, gsna->v, gsna->l);
+ return 0;
+}
+
+int in_addr2gsna(struct ul16_t *gsna, struct in_addr *src)
+{
+ memset(gsna, 0, sizeof(struct ul16_t));
+ gsna->l = 4;
+ memcpy(gsna->v, src, gsna->l);
+ return 0;
+}
+
+/* ***********************************************************
* Session management messages
* Messages: create, update and delete PDP context
*
@@ -3052,40 +3086,6 @@
return 0;
}
-/* ***********************************************************
- * Conversion functions
- *************************************************************/
-
-/* ***********************************************************
- * IP address conversion functions
- * There exist several types of address representations:
- * - eua: End User Address. (29.060, 7.7.27, message type 128)
- * Used for signalling address to mobile station. Supports IPv4
- * IPv6 x.25 etc. etc.
- * - gsna: GSN Address. (29.060, 7.7.32, message type 133): IP address
- * of GSN. If length is 4 it is IPv4. If length is 16 it is IPv6.
- * - in_addr: IPv4 address struct.
- * - sockaddr_in: Socket API representation of IP address and
- * port number.
- *************************************************************/
-
-int gsna2in_addr(struct in_addr *dst, struct ul16_t *gsna)
-{
- memset(dst, 0, sizeof(struct in_addr));
- if (gsna->l != 4)
- return EOF; /* Return if not IPv4 */
- memcpy(dst, gsna->v, gsna->l);
- return 0;
-}
-
-int in_addr2gsna(struct ul16_t *gsna, struct in_addr *src)
-{
- memset(gsna, 0, sizeof(struct ul16_t));
- gsna->l = 4;
- memcpy(gsna->v, src, gsna->l);
- return 0;
-}
-
/* TS 29.060 has yet again a different encoding for IMSIs than
* what we have in other places, so we cannot use the gsm48
* decoding functions. Also, libgtp uses an uint64_t in
--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/36791?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I51e6a7c1161320fc54b0e8197ae57e4327976eb1
Gerrit-Change-Number: 36791
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: fixeria, laforge.
osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/36066?usp=email )
Change subject: libgtp: move includes to osmocom/include/gtp
......................................................................
Patch Set 2: Code-Review+2
(1 comment)
File gtp/Makefile.am:
https://gerrit.osmocom.org/c/osmo-ggsn/+/36066/comment/6fefeef4_56649066
PS2, Line 22: lookupa.h
yes, because it did not get installed to /usr/include before. See the deleted line in this file:
> include_HEADERS = gtp.h gsn.h pdp.h gtpie.h
--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/36066?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: If7e01c61168819bf7120667344e40c857da5490b
Gerrit-Change-Number: 36066
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 16 May 2024 08:37:02 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: comment