lynxis lazus has uploaded this change for review.

View Change

gtp: add internal functions gtp_reqv1c/gtp_respv1c

Will be used by SGSN Context Req/Resp/Ack.

Change-Id: If1a60a2ea08b74aaf23485e036b9632f38ab4bda
---
M gtp/gtp.c
1 file changed, 27 insertions(+), 0 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/38/39238/1
diff --git a/gtp/gtp.c b/gtp/gtp.c
index 3209a64..e6180fa 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -404,6 +404,18 @@
return 0;
}

+static int gtp_reqv1c(struct gsn_t *gsn, uint32_t teic,
+ union gtp_packet *packet, int len,
+ const struct in_addr *inetaddr, void *cbp)
+{
+ packet->flags |= GTP1HDR_F_SEQ;
+ packet->gtp1l.h.length = hton16(len - GTP1_HEADER_SIZE_SHORT);
+ packet->gtp1l.h.seq = hton16(gsn->seq_next);
+ packet->gtp1l.h.tei = hton32(teic);
+
+ return gtp_req_transmit(gsn, 1, inetaddr, packet, len, NULL, cbp);
+}
+
static int gtp_req(struct gsn_t *gsn, uint8_t version, struct pdp_t *pdp,
union gtp_packet *packet, int len,
const struct in_addr *inetaddr, void *cbp)
@@ -563,6 +575,21 @@
return gtp_resp(gsn, packet, len, peer, fd, seq, tid, flow, tei);
}

+static int gtp_respv1c(struct gsn_t *gsn, uint16_t seq, uint32_t remote_teic,
+ union gtp_packet *packet, int len,
+ const struct in_addr *inetaddr)
+{
+ struct sockaddr_in peer = {};
+ peer.sin_addr = *inetaddr;
+ peer.sin_port = htons(GTP1C_PORT);
+ peer.sin_family = AF_INET;
+
+ packet->flags |= GTP1HDR_F_SEQ | GTP1HDR_F_GTP1;
+ packet->gtp1l.h.length = hton16(len - GTP1_HEADER_SIZE_SHORT);
+
+ return gtp_resp(gsn, packet, len, &peer, gsn->fd1c, seq, 0, 0, remote_teic);
+}
+
static int gtp_notification(struct gsn_t *gsn, uint8_t version,
union gtp_packet *packet, int len,
const struct sockaddr_in *peer, int fd, uint16_t seq)

To view, visit change 39238. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: If1a60a2ea08b74aaf23485e036b9632f38ab4bda
Gerrit-Change-Number: 39238
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis@fe80.eu>