Change in osmo-sgsn[rel-1.5.1]: gtphub: rename sgsn's oww osmo_sockaddr into sgsn_sockaddr

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Aug 13 09:42:20 UTC 2020


Hello lynxis lazus,

I'd like you to do a code review. Please visit

    https://gerrit.osmocom.org/c/osmo-sgsn/+/19615

to review the following change.


Change subject: gtphub: rename sgsn's oww osmo_sockaddr into sgsn_sockaddr
......................................................................

gtphub: rename sgsn's oww osmo_sockaddr into sgsn_sockaddr

The osmo_ prefix should be only used for official struct/apis of libosmocore.
This commit was done via `sed -i 's/osmo_sockaddr/sgsn_sockaddr/g'`.

In prepartion of introducing a different api of osmo_sockaddr to
libosmocore.

Change-Id: Ibb1ddce9ff1ffe7494de5cdb8ea1843c45fe4566
---
M include/osmocom/sgsn/gtphub.h
M src/gprs/gtphub.c
M src/gprs/gtphub_sock.c
M tests/gtphub/gtphub_test.c
4 files changed, 95 insertions(+), 95 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/15/19615/1

diff --git a/include/osmocom/sgsn/gtphub.h b/include/osmocom/sgsn/gtphub.h
index 8fd9f38..6a439b5 100644
--- a/include/osmocom/sgsn/gtphub.h
+++ b/include/osmocom/sgsn/gtphub.h
@@ -35,14 +35,14 @@
 
 /* TODO move to osmocom/core/socket.c ? */
 #include <netdb.h> /* for IPPROTO_* etc */
-struct osmo_sockaddr {
+struct sgsn_sockaddr {
 	struct sockaddr_storage a;
 	socklen_t l;
 };
 
 /* TODO move to osmocom/core/socket.c ? */
 /*! \brief Initialize a sockaddr
- * \param[out] addr  Valid osmo_sockaddr pointer to write result to
+ * \param[out] addr  Valid sgsn_sockaddr pointer to write result to
  * \param[in] family  Address Family like AF_INET, AF_INET6, AF_UNSPEC
  * \param[in] type  Socket type like SOCK_DGRAM, SOCK_STREAM
  * \param[in] proto  Protocol like IPPROTO_TCP, IPPROTO_UDP
@@ -53,16 +53,16 @@
  * Copy the first result from a getaddrinfo() call with the given parameters to
  * *addr and *addr_len. On error, do not change *addr and return nonzero.
  */
-int osmo_sockaddr_init(struct osmo_sockaddr *addr,
+int sgsn_sockaddr_init(struct sgsn_sockaddr *addr,
 		       uint16_t family, uint16_t type, uint8_t proto,
 		       const char *host, uint16_t port);
 
 /* Conveniently pass AF_UNSPEC, SOCK_DGRAM and IPPROTO_UDP to
- * osmo_sockaddr_init(). */
-static inline int osmo_sockaddr_init_udp(struct osmo_sockaddr *addr,
+ * sgsn_sockaddr_init(). */
+static inline int sgsn_sockaddr_init_udp(struct sgsn_sockaddr *addr,
 					 const char *host, uint16_t port)
 {
-	return osmo_sockaddr_init(addr, AF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP,
+	return sgsn_sockaddr_init(addr, AF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP,
 				  host, port);
 }
 
@@ -71,25 +71,25 @@
  * \param[in] addr_str_len  Size of buffer addr_str points at.
  * \param[out] port_str  Valid pointer to a buffer of length port_str_len.
  * \param[in] port_str_len  Size of buffer port_str points at.
- * \param[in] addr  Binary representation as returned by osmo_sockaddr_init().
+ * \param[in] addr  Binary representation as returned by sgsn_sockaddr_init().
  * \param[in] flags  flags as passed to getnameinfo().
  * \returns  0 on success, an error code on error.
  *
  * Return the IPv4 or IPv6 address string and the port (a.k.a. service) string
- * representations of the given struct osmo_sockaddr in two caller provided
+ * representations of the given struct sgsn_sockaddr in two caller provided
  * char buffers. Flags of (NI_NUMERICHOST | NI_NUMERICSERV) return numeric
  * address and port. Either one of addr_str or port_str may be NULL, in which
  * case nothing is returned there.
  *
- * See also osmo_sockaddr_to_str() (less flexible, but much more convenient). */
-int osmo_sockaddr_to_strs(char *addr_str, size_t addr_str_len,
+ * See also sgsn_sockaddr_to_str() (less flexible, but much more convenient). */
+int sgsn_sockaddr_to_strs(char *addr_str, size_t addr_str_len,
 			  char *port_str, size_t port_str_len,
-			  const struct osmo_sockaddr *addr,
+			  const struct sgsn_sockaddr *addr,
 			  int flags);
 
 
-/*! \brief concatenate the parts returned by osmo_sockaddr_to_strs().
- * \param[in] addr  Binary representation as returned by osmo_sockaddr_init().
+/*! \brief concatenate the parts returned by sgsn_sockaddr_to_strs().
+ * \param[in] addr  Binary representation as returned by sgsn_sockaddr_init().
  * \param[in] buf  A buffer to use for string operations.
  * \param[in] buf_len  Length of the buffer.
  * \returns  Address string (in buffer).
@@ -98,33 +98,33 @@
  * the form "<ip-addr> port <port>". The returned string is valid until the
  * next invocation of this function.
  */
-const char *osmo_sockaddr_to_strb(const struct osmo_sockaddr *addr,
+const char *sgsn_sockaddr_to_strb(const struct sgsn_sockaddr *addr,
 				  char *buf, size_t buf_len);
 
-/*! \brief conveniently return osmo_sockaddr_to_strb() in a static buffer.
- * \param[in] addr  Binary representation as returned by osmo_sockaddr_init().
+/*! \brief conveniently return sgsn_sockaddr_to_strb() in a static buffer.
+ * \param[in] addr  Binary representation as returned by sgsn_sockaddr_init().
  * \returns  Address string in static buffer.
  *
- * See osmo_sockaddr_to_strb().
+ * See sgsn_sockaddr_to_strb().
  *
- * Note: only one osmo_sockaddr_to_str() call will work per print/log
- * statement. For two or more, use osmo_sockaddr_to_strb() with a separate
+ * Note: only one sgsn_sockaddr_to_str() call will work per print/log
+ * statement. For two or more, use sgsn_sockaddr_to_strb() with a separate
  * buffer each.
  */
-const char *osmo_sockaddr_to_str(const struct osmo_sockaddr *addr);
+const char *sgsn_sockaddr_to_str(const struct sgsn_sockaddr *addr);
 
-/*! \brief compare two osmo_sockaddr.
+/*! \brief compare two sgsn_sockaddr.
  * \param[in] a  The first address to compare.
  * \param[in] b  The other address to compare.
  * \returns 0 if equal, otherwise -1 or 1.
  */
-int osmo_sockaddr_cmp(const struct osmo_sockaddr *a,
-		      const struct osmo_sockaddr *b);
+int sgsn_sockaddr_cmp(const struct sgsn_sockaddr *a,
+		      const struct sgsn_sockaddr *b);
 
 /*! \brief Overwrite *dst with *src.
  * Like memcpy(), but copy only the valid bytes. */
-void osmo_sockaddr_copy(struct osmo_sockaddr *dst,
-			const struct osmo_sockaddr *src);
+void sgsn_sockaddr_copy(struct sgsn_sockaddr *dst,
+			const struct sgsn_sockaddr *src);
 
 
 /* general */
@@ -179,7 +179,7 @@
 /* Decode sa to gsna. Return 0 on success. If port is non-NULL, the port number
  * from sa is also returned. */
 int gsn_addr_from_sockaddr(struct gsn_addr *gsna, uint16_t *port,
-			   const struct osmo_sockaddr *sa);
+			   const struct sgsn_sockaddr *sa);
 
 /* expiry */
 
@@ -389,7 +389,7 @@
 	struct gtphub_peer_addr *peer_addr;
 	uint16_t port;
 	unsigned int ref_count; /* references from other peers' seq_maps */
-	struct osmo_sockaddr sa; /* a "cache" for (peer_addr->addr, port) */
+	struct sgsn_sockaddr sa; /* a "cache" for (peer_addr->addr, port) */
 	int last_restart_count; /* 0..255 = valid, all else means unknown */
 
 	struct rate_ctr_group *counters_io;
@@ -496,13 +496,13 @@
 int gtphub_handle_buf(struct gtphub *hub,
 		      unsigned int side_idx,
 		      unsigned int port_idx,
-		      const struct osmo_sockaddr *from_addr,
+		      const struct sgsn_sockaddr *from_addr,
 		      uint8_t *buf,
 		      size_t received,
 		      time_t now,
 		      uint8_t **reply_buf,
 		      struct osmo_fd **to_ofd,
-		      struct osmo_sockaddr *to_addr);
+		      struct sgsn_sockaddr *to_addr);
 
 struct gtphub_peer_port *gtphub_port_have(struct gtphub *hub,
 					  struct gtphub_bind *bind,
@@ -510,7 +510,7 @@
 					  uint16_t port);
 
 struct gtphub_peer_port *gtphub_port_find_sa(const struct gtphub_bind *bind,
-					     const struct osmo_sockaddr *addr);
+					     const struct sgsn_sockaddr *addr);
 
 void gtphub_resolved_ggsn(struct gtphub *hub, const char *apn_oi_str,
 			  struct gsn_addr *resolved_addr,
@@ -519,5 +519,5 @@
 const char *gtphub_port_str(struct gtphub_peer_port *port);
 
 int gtphub_write(const struct osmo_fd *to,
-		 const struct osmo_sockaddr *to_addr,
+		 const struct sgsn_sockaddr *to_addr,
 		 const uint8_t *buf, size_t buf_len);
diff --git a/src/gprs/gtphub.c b/src/gprs/gtphub.c
index ca5857b..3e5c6f0 100644
--- a/src/gprs/gtphub.c
+++ b/src/gprs/gtphub.c
@@ -167,12 +167,12 @@
 }
 
 int gsn_addr_from_sockaddr(struct gsn_addr *gsna, uint16_t *port,
-			   const struct osmo_sockaddr *sa)
+			   const struct sgsn_sockaddr *sa)
 {
 	char addr_str[256];
 	char port_str[6];
 
-	if (osmo_sockaddr_to_strs(addr_str, sizeof(addr_str),
+	if (sgsn_sockaddr_to_strs(addr_str, sizeof(addr_str),
 				  port_str, sizeof(port_str),
 				  sa, (NI_NUMERICHOST | NI_NUMERICSERV))
 	    != 0) {
@@ -925,7 +925,7 @@
 /* Recv datagram from from->fd, write sender's address to *from_addr.
  * Return the number of bytes read, zero on error. */
 static int gtphub_read(const struct osmo_fd *from,
-		       struct osmo_sockaddr *from_addr,
+		       struct sgsn_sockaddr *from_addr,
 		       uint8_t *buf, size_t buf_len)
 {
 	OSMO_ASSERT(from_addr);
@@ -946,7 +946,7 @@
 	}
 
 	LOG(LOGL_DEBUG, "Received %d bytes from %s: %s%s\n",
-	    (int)received, osmo_sockaddr_to_str(from_addr),
+	    (int)received, sgsn_sockaddr_to_str(from_addr),
 	    osmo_hexdump(buf, received > 1000? 1000 : received),
 	    received > 1000 ? "..." : "");
 
@@ -1954,8 +1954,8 @@
 	struct gtphub *hub = from_sgsns_ofd->data;
 
 	static uint8_t buf[4096];
-	struct osmo_sockaddr from_addr;
-	struct osmo_sockaddr to_addr;
+	struct sgsn_sockaddr from_addr;
+	struct sgsn_sockaddr to_addr;
 	struct osmo_fd *to_ofd;
 	int len;
 	uint8_t *reply_buf;
@@ -1985,8 +1985,8 @@
 	struct gtphub *hub = from_ggsns_ofd->data;
 
 	static uint8_t buf[4096];
-	struct osmo_sockaddr from_addr;
-	struct osmo_sockaddr to_addr;
+	struct sgsn_sockaddr from_addr;
+	struct sgsn_sockaddr to_addr;
 	struct osmo_fd *to_ofd;
 	int len;
 	uint8_t *reply_buf;
@@ -2071,9 +2071,9 @@
 
 static int gsn_addr_to_sockaddr(struct gsn_addr *src,
 				uint16_t port,
-				struct osmo_sockaddr *dst)
+				struct sgsn_sockaddr *dst)
 {
-	return osmo_sockaddr_init_udp(dst, gsn_addr_to_str(src), port);
+	return sgsn_sockaddr_init_udp(dst, gsn_addr_to_str(src), port);
 }
 
 /* If p is an Echo request, replace p's data with the matching response and
@@ -2107,7 +2107,7 @@
 }
 
 struct gtphub_peer_port *gtphub_known_addr_have_port(const struct gtphub_bind *bind,
-						     const struct osmo_sockaddr *addr);
+						     const struct sgsn_sockaddr *addr);
 
 /* Parse buffer as GTP packet, replace elements in-place and return the ofd and
  * address to forward to. Return a pointer to the osmo_fd, but copy the
@@ -2117,13 +2117,13 @@
 int gtphub_handle_buf(struct gtphub *hub,
 		      unsigned int side_idx,
 		      unsigned int plane_idx,
-		      const struct osmo_sockaddr *from_addr,
+		      const struct sgsn_sockaddr *from_addr,
 		      uint8_t *buf,
 		      size_t received,
 		      time_t now,
 		      uint8_t **reply_buf,
 		      struct osmo_fd **to_ofd,
-		      struct osmo_sockaddr *to_addr)
+		      struct sgsn_sockaddr *to_addr)
 {
 	struct gtphub_bind *from_bind = &hub->to_gsns[side_idx][plane_idx];
 	struct gtphub_bind *to_bind = &hub->to_gsns[other_side_idx(side_idx)][plane_idx];
@@ -2138,7 +2138,7 @@
 	    (side_idx == GTPH_SIDE_GGSN)? "<-" : "->",
 	    gtphub_plane_idx_names[plane_idx],
 	    gtphub_side_idx_names[side_idx],
-	    osmo_sockaddr_to_str(from_addr),
+	    sgsn_sockaddr_to_str(from_addr),
 	    gtp_type_str(p.type));
 
 	if (p.rc <= 0) {
@@ -2146,7 +2146,7 @@
 		    gtp_type_str(p.type),
 		    gtphub_side_idx_names[side_idx],
 		    gtphub_plane_idx_names[plane_idx],
-		    osmo_sockaddr_to_str(from_addr));
+		    sgsn_sockaddr_to_str(from_addr));
 		return -1;
 	}
 
@@ -2156,7 +2156,7 @@
 	reply_len = gtphub_handle_echo_req(hub, &p, reply_buf);
 	if (reply_len > 0) {
 		/* It was an echo. Nothing left to do. */
-		osmo_sockaddr_copy(to_addr, from_addr);
+		sgsn_sockaddr_copy(to_addr, from_addr);
 		*to_ofd = &from_bind->ofd;
 
 		rate_ctr_inc(&from_bind->counters_io->ctr[GTPH_CTR_PKTS_OUT]);
@@ -2165,7 +2165,7 @@
 		LOG(LOGL_DEBUG, "%s Echo response to %s: %d bytes to %s\n",
 		    (side_idx == GTPH_SIDE_GGSN)? "-->" : "<--",
 		    gtphub_side_idx_names[side_idx],
-		    (int)reply_len, osmo_sockaddr_to_str(to_addr));
+		    (int)reply_len, sgsn_sockaddr_to_str(to_addr));
 		return reply_len;
 	}
 	if (reply_len < 0)
@@ -2178,7 +2178,7 @@
 	 * so no-one else is allowed to talk to us from that side. */
 	struct gtphub_peer_port *from_peer = hub->proxy[side_idx][plane_idx];
 	if (from_peer) {
-		if (osmo_sockaddr_cmp(&from_peer->sa, from_addr) != 0) {
+		if (sgsn_sockaddr_cmp(&from_peer->sa, from_addr) != 0) {
 			LOG(LOGL_ERROR,
 			    "Rejecting: %s proxy configured, but GTP packet"
 			    " received on %s bind is from another sender:"
@@ -2186,7 +2186,7 @@
 			    gtphub_side_idx_names[side_idx],
 			    gtphub_side_idx_names[side_idx],
 			    gtphub_port_str(from_peer),
-			    osmo_sockaddr_to_str(from_addr));
+			    sgsn_sockaddr_to_str(from_addr));
 			return -1;
 		}
 	}
@@ -2204,7 +2204,7 @@
 		if (side_idx == GTPH_SIDE_GGSN) {
 			LOG(LOGL_ERROR, "Dropping packet%s: unknown GGSN peer: %s\n",
 			    gtp_type_str(p.type),
-			    osmo_sockaddr_to_str(from_addr));
+			    sgsn_sockaddr_to_str(from_addr));
 			return -1;
 		} else {
 			/* SGSN */
@@ -2216,7 +2216,7 @@
 				    "Dropping packet%s: User plane peer was not"
 				    "announced by PDP Context: %s\n",
 				    gtp_type_str(p.type),
-				    osmo_sockaddr_to_str(from_addr));
+				    sgsn_sockaddr_to_str(from_addr));
 				return -1;
 			}
 
@@ -2235,7 +2235,7 @@
 		LOG(LOGL_ERROR, "Dropping packet%s: invalid %s peer: %s\n",
 		    gtp_type_str(p.type),
 		    gtphub_side_idx_names[side_idx],
-		    osmo_sockaddr_to_str(from_addr));
+		    sgsn_sockaddr_to_str(from_addr));
 		return -1;
 	}
 
@@ -2309,7 +2309,7 @@
 	if (!to_peer_from_seq)
 		gtphub_map_seq(&p, from_peer, to_peer);
 
-	osmo_sockaddr_copy(to_addr, &to_peer->sa);
+	sgsn_sockaddr_copy(to_addr, &to_peer->sa);
 
 	*reply_buf = (uint8_t*)p.data;
 
@@ -2335,7 +2335,7 @@
 	    (side_idx == GTPH_SIDE_SGSN)? "-->" : "<--",
 	    gtphub_side_idx_names[other_side_idx(side_idx)],
 	    p.header_tei, p.seq,
-	    (int)received, osmo_sockaddr_to_str(to_addr));
+	    (int)received, sgsn_sockaddr_to_str(to_addr));
 	return received;
 }
 
@@ -2645,7 +2645,7 @@
 }
 
 struct gtphub_peer_port *gtphub_port_find_sa(const struct gtphub_bind *bind,
-					     const struct osmo_sockaddr *addr)
+					     const struct sgsn_sockaddr *addr)
 {
 	struct gsn_addr gsna;
 	uint16_t port;
@@ -2762,7 +2762,7 @@
 /* Find a GGSN peer with a matching address. If the address is known but the
  * port not, create a new port for that peer address. */
 struct gtphub_peer_port *gtphub_known_addr_have_port(const struct gtphub_bind *bind,
-						     const struct osmo_sockaddr *addr)
+						     const struct sgsn_sockaddr *addr)
 {
 	struct gtphub_peer_addr *pa;
 	struct gtphub_peer_port *pp;
@@ -2817,7 +2817,7 @@
 
 /* TODO move to osmocom/core/socket.c ? */
 /* use this in osmo_sock_init() to remove dup. */
-/* Internal: call getaddrinfo for osmo_sockaddr_init(). The caller is required
+/* Internal: call getaddrinfo for sgsn_sockaddr_init(). The caller is required
    to call freeaddrinfo(*result), iff zero is returned. */
 static int _osmo_getaddrinfo(struct addrinfo **result,
 			     uint16_t family, uint16_t type, uint8_t proto,
@@ -2844,7 +2844,7 @@
 }
 
 /* TODO move to osmocom/core/socket.c ? */
-int osmo_sockaddr_init(struct osmo_sockaddr *addr,
+int sgsn_sockaddr_init(struct sgsn_sockaddr *addr,
 		       uint16_t family, uint16_t type, uint8_t proto,
 		       const char *host, uint16_t port)
 {
@@ -2865,9 +2865,9 @@
 	return 0;
 }
 
-int osmo_sockaddr_to_strs(char *addr_str, size_t addr_str_len,
+int sgsn_sockaddr_to_strs(char *addr_str, size_t addr_str_len,
 			  char *port_str, size_t port_str_len,
-			  const struct osmo_sockaddr *addr,
+			  const struct sgsn_sockaddr *addr,
 			  int flags)
 {
        int rc;
@@ -2896,14 +2896,14 @@
        return rc;
 }
 
-const char *osmo_sockaddr_to_strb(const struct osmo_sockaddr *addr,
+const char *sgsn_sockaddr_to_strb(const struct sgsn_sockaddr *addr,
 				  char *buf, size_t buf_len)
 {
 	const int portbuf_len = 6;
 	OSMO_ASSERT(buf_len > portbuf_len);
 	char *portbuf = buf + buf_len - portbuf_len;
 	buf_len -= portbuf_len;
-	if (osmo_sockaddr_to_strs(buf, buf_len,
+	if (sgsn_sockaddr_to_strs(buf, buf_len,
 				  portbuf, portbuf_len,
 				  addr,
 				  NI_NUMERICHOST | NI_NUMERICSERV))
@@ -2918,17 +2918,17 @@
 	return buf;
 }
 
-const char *osmo_sockaddr_to_str(const struct osmo_sockaddr *addr)
+const char *sgsn_sockaddr_to_str(const struct sgsn_sockaddr *addr)
 {
 	static char buf[256];
-	const char *result = osmo_sockaddr_to_strb(addr, buf, sizeof(buf));
+	const char *result = sgsn_sockaddr_to_strb(addr, buf, sizeof(buf));
 	if (! result)
 		return "(invalid)";
 	return result;
 }
 
-int osmo_sockaddr_cmp(const struct osmo_sockaddr *a,
-		      const struct osmo_sockaddr *b)
+int sgsn_sockaddr_cmp(const struct sgsn_sockaddr *a,
+		      const struct sgsn_sockaddr *b)
 {
 	if (a == b)
 		return 0;
@@ -2938,7 +2938,7 @@
 		return 1;
 	if (a->l != b->l) {
 		/* Lengths are not the same, but determine the order. Will
-		 * anyone ever sort a list by osmo_sockaddr though...? */
+		 * anyone ever sort a list by sgsn_sockaddr though...? */
 		int cmp = memcmp(&a->a, &b->a, (a->l < b->l)? a->l : b->l);
 		if (cmp == 0) {
 			if (a->l < b->l)
@@ -2951,8 +2951,8 @@
 	return memcmp(&a->a, &b->a, a->l);
 }
 
-void osmo_sockaddr_copy(struct osmo_sockaddr *dst,
-			const struct osmo_sockaddr *src)
+void sgsn_sockaddr_copy(struct sgsn_sockaddr *dst,
+			const struct sgsn_sockaddr *src)
 {
 	OSMO_ASSERT(src->l <= sizeof(dst->a));
 	memcpy(&dst->a, &src->a, src->l);
diff --git a/src/gprs/gtphub_sock.c b/src/gprs/gtphub_sock.c
index 1acd5a6..1837533 100644
--- a/src/gprs/gtphub_sock.c
+++ b/src/gprs/gtphub_sock.c
@@ -33,13 +33,13 @@
 	LOGP(DGTPHUB, level, fmt, ##args)
 
 int gtphub_write(const struct osmo_fd *to,
-		 const struct osmo_sockaddr *to_addr,
+		 const struct sgsn_sockaddr *to_addr,
 		 const uint8_t *buf, size_t buf_len)
 {
 	errno = 0;
 	ssize_t sent = sendto(to->fd, buf, buf_len, 0,
 			      (struct sockaddr*)&to_addr->a, to_addr->l);
-	LOG(LOGL_DEBUG, "to %s\n", osmo_sockaddr_to_str(to_addr));
+	LOG(LOGL_DEBUG, "to %s\n", sgsn_sockaddr_to_str(to_addr));
 
 	if (sent == -1) {
 		LOG(LOGL_ERROR, "error: %s\n", strerror(errno));
diff --git a/tests/gtphub/gtphub_test.c b/tests/gtphub/gtphub_test.c
index 2e48bb1..9a8ec6b 100644
--- a/tests/gtphub/gtphub_test.c
+++ b/tests/gtphub/gtphub_test.c
@@ -378,37 +378,37 @@
 char resolve_ggsn_got_imsi[GSM23003_IMSI_MAX_DIGITS+1];
 char resolve_ggsn_got_ni[GSM_APN_LENGTH];
 
-struct osmo_sockaddr resolved_ggsn_addr;
+struct sgsn_sockaddr resolved_ggsn_addr;
 static int resolve_to_ggsn(const char *addr, uint16_t port)
 {
-	LVL2_ASSERT(osmo_sockaddr_init_udp(&resolved_ggsn_addr,
+	LVL2_ASSERT(sgsn_sockaddr_init_udp(&resolved_ggsn_addr,
 					   addr, port)
 		    == 0);
 	return 1;
 }
 
-struct osmo_sockaddr resolved_sgsn_addr;
+struct sgsn_sockaddr resolved_sgsn_addr;
 static int resolve_to_sgsn(const char *addr, uint16_t port)
 {
-	LVL2_ASSERT(osmo_sockaddr_init_udp(&resolved_sgsn_addr,
+	LVL2_ASSERT(sgsn_sockaddr_init_udp(&resolved_sgsn_addr,
 					   addr, port)
 		    == 0);
 	return 1;
 }
 
-struct osmo_sockaddr sgsn_sender;
+struct sgsn_sockaddr sgsn_sender;
 static int send_from_sgsn(const char *addr, uint16_t port)
 {
-	LVL2_ASSERT(osmo_sockaddr_init_udp(&sgsn_sender,
+	LVL2_ASSERT(sgsn_sockaddr_init_udp(&sgsn_sender,
 					   addr, port)
 		    == 0);
 	return 1;
 }
 
-struct osmo_sockaddr ggsn_sender;
+struct sgsn_sockaddr ggsn_sender;
 static int send_from_ggsn(const char *addr, uint16_t port)
 {
-	LVL2_ASSERT(osmo_sockaddr_init_udp(&ggsn_sender,
+	LVL2_ASSERT(sgsn_sockaddr_init_udp(&ggsn_sender,
 					   addr, port)
 		    == 0);
 	return 1;
@@ -491,18 +491,18 @@
 
 /* override, requires '-Wl,--wrap=gtphub_write' */
 int __real_gtphub_write(const struct osmo_fd *to,
-			const struct osmo_sockaddr *to_addr,
+			const struct sgsn_sockaddr *to_addr,
 			const uint8_t *buf, size_t buf_len);
 
 int __wrap_gtphub_write(const struct osmo_fd *to,
-			const struct osmo_sockaddr *to_addr,
+			const struct sgsn_sockaddr *to_addr,
 			const uint8_t *buf, size_t buf_len)
 {
 	printf("Out-of-band gtphub_write(%d):\n"
 	       "to %s\n"
 	       "%s\n",
 	       (int)buf_len,
-	       osmo_sockaddr_to_str(to_addr),
+	       sgsn_sockaddr_to_str(to_addr),
 	       osmo_hexdump(buf, buf_len));
 	return 0;
 }
@@ -553,11 +553,11 @@
 }
 
 #define same_addr(GOT, EXPECTED) _same_addr((GOT),(EXPECTED), __FILE__, __LINE__)
-static int _same_addr(const struct osmo_sockaddr *got,
-		      const struct osmo_sockaddr *expected,
+static int _same_addr(const struct sgsn_sockaddr *got,
+		      const struct sgsn_sockaddr *expected,
 		      const char *file, int line)
 {
-	int cmp = osmo_sockaddr_cmp(got, expected);
+	int cmp = sgsn_sockaddr_cmp(got, expected);
 	if (!cmp)
 		return 1;
 	char buf[256];
@@ -565,8 +565,8 @@
 	       "  expecting: '%s'\n"
 	       "        got: '%s'\n\n",
 	       file, line,
-	       osmo_sockaddr_to_str(expected),
-	       osmo_sockaddr_to_strb(got, buf, sizeof(buf)));
+	       sgsn_sockaddr_to_str(expected),
+	       sgsn_sockaddr_to_strb(got, buf, sizeof(buf)));
 	return 0;
 }
 
@@ -668,7 +668,7 @@
 	now = 123;
 
 	struct osmo_fd *to_ofd;
-	struct osmo_sockaddr to_addr;
+	struct sgsn_sockaddr to_addr;
 	struct gtphub_peer_port *pp;
 	int send;
 
@@ -855,13 +855,13 @@
 #define msg_from_sgsn_c(A,B,C,D) msg_from_sgsn(GTPH_PLANE_CTRL, A,B,C,D)
 #define msg_from_sgsn_u(A,B,C,D) msg_from_sgsn(GTPH_PLANE_USER, A,B,C,D)
 static int msg_from_sgsn(int plane_idx,
-			 struct osmo_sockaddr *_sgsn_sender,
-			 struct osmo_sockaddr *ggsn_receiver,
+			 struct sgsn_sockaddr *_sgsn_sender,
+			 struct sgsn_sockaddr *ggsn_receiver,
 			 const char *hex_from_sgsn,
 			 const char *hex_to_ggsn)
 {
 	struct osmo_fd *ggsn_ofd = NULL;
-	struct osmo_sockaddr ggsn_addr;
+	struct sgsn_sockaddr ggsn_addr;
 	int send;
 	send = gtphub_handle_buf(hub, GTPH_SIDE_SGSN, plane_idx, _sgsn_sender,
 				 buf, msg(hex_from_sgsn), now,
@@ -875,13 +875,13 @@
 #define msg_from_ggsn_c(A,B,C,D) msg_from_ggsn(GTPH_PLANE_CTRL, A,B,C,D)
 #define msg_from_ggsn_u(A,B,C,D) msg_from_ggsn(GTPH_PLANE_USER, A,B,C,D)
 static int msg_from_ggsn(int plane_idx,
-			 struct osmo_sockaddr *ggsn_sender,
-			 struct osmo_sockaddr *sgsn_receiver,
+			 struct sgsn_sockaddr *ggsn_sender,
+			 struct sgsn_sockaddr *sgsn_receiver,
 			 const char *msg_from_ggsn,
 			 const char *msg_to_sgsn)
 {
 	struct osmo_fd *sgsn_ofd;
-	struct osmo_sockaddr sgsn_addr;
+	struct sgsn_sockaddr sgsn_addr;
 	int send;
 	send = gtphub_handle_buf(hub, GTPH_SIDE_GGSN, plane_idx, ggsn_sender,
 				 buf, msg(msg_from_ggsn), now,

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/19615
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: rel-1.5.1
Gerrit-Change-Id: Ibb1ddce9ff1ffe7494de5cdb8ea1843c45fe4566
Gerrit-Change-Number: 19615
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200813/f80a8c93/attachment.htm>


More information about the gerrit-log mailing list