Commit 8312b0ab authored by Rohan's avatar Rohan

gtpu extension header added for downlink

parent 0c16a497
......@@ -134,6 +134,7 @@ public:
virtual ~gtpu_ie_value_exception() throw(){}
};
#define GTPU_NO_MORE_EXTENSION_HEADER (0)
#define GTPU_IE_RECOVERY 14
#define GTPU_IE_TUNNEL_ENDPOINT_IDENTIFIER_DATA_I 16
#define GTPU_IE_GTP_U_PEER_ADDRESS 133
......@@ -147,6 +148,9 @@ public:
#define GTPU_END_MARKER (254)
#define GTPU_G_PDU (255)
#define GTPU_DL_PDU_SESSION_INFORMATION (0)
#define GTPU_UL_PDU_SESSION_INFORMATION (1)
#define GTPU_PDU_SESSION_CONTAINER (133)
} // namespace
// 8.2 Recovery
......
......@@ -67,6 +67,22 @@ struct gtpuhdr
uint32_t teid;
/*The options start here. */
};
#endif
/*The options start here. */
uint16_t sequence;
uint8_t pdu_number;
uint8_t next_ext_type;
};
#endif
struct gtpu_ext_hdr{
struct gtpuhdr gtpu_hdr;
uint8_t message_length;
// PDU Type - This value indicates the structure of the PDU session UP frame. The field takes the value of the PDU
// Type it identifies; i.e. "0" for PDU Type 0. The PDU type is in bit 4 to bit 7 in the first octet of the frame.
uint8_t pdu_type;
// QoS Flow Identifier (QFI): This parameter indicates the QoS Flow Identifier of the QoS flow to which
// the transferred packet bel
uint8_t qfi;
// Next Extension Header Type - This field defines the type of Extension Header that follows this field in the GTP-PDU
uint8_t next_ext_type;
};
......@@ -161,7 +161,7 @@ void gtpu_l4_stack::handle_receive_message_cb(
void gtpu_l4_stack::send_g_pdu(
const struct sockaddr_in& peer_addr, const teid_t teid, const char* payload,
const ssize_t payload_len) {
struct gtpuhdr* gtpuhdr = reinterpret_cast<struct gtpuhdr*>(
/* struct gtpuhdr* gtpuhdr = reinterpret_cast<struct gtpuhdr*>(
reinterpret_cast<uintptr_t>(payload) -
(uintptr_t) sizeof(struct gtpuhdr));
gtpuhdr->spare = 0;
......@@ -175,7 +175,36 @@ void gtpu_l4_stack::send_g_pdu(
gtpuhdr->teid = htobe32(teid);
udp_s.async_send_to(
reinterpret_cast<const char*>(gtpuhdr),
payload_len + sizeof(struct gtpuhdr), peer_addr);
payload_len + sizeof(struct gtpuhdr), peer_addr);*/
// test this for multiple extension header
struct gtpu_ext_hdr* gtpu_ext_hdr = reinterpret_cast<struct gtpu_ext_hdr*>(
reinterpret_cast<uintptr_t>(payload) -
(uintptr_t) sizeof(struct gtpu_ext_hdr));
gtpu_ext_hdr->gtpu_hdr.spare = 0;
// gtpuhdr->e = 0;
gtpu_ext_hdr->gtpu_hdr.e = 1;
gtpu_ext_hdr->gtpu_hdr.s = 0;
gtpu_ext_hdr->gtpu_hdr.pn = 0;
gtpu_ext_hdr->gtpu_hdr.pt = 1;
gtpu_ext_hdr->gtpu_hdr.version = 1;
gtpu_ext_hdr->gtpu_hdr.message_type = GTPU_G_PDU;
// gtpuhdr->message_length = htobe16(payload_len);
gtpu_ext_hdr->gtpu_hdr.message_length = htobe16(payload_len + 8);
gtpu_ext_hdr->gtpu_hdr.teid = htobe32(teid);
gtpu_ext_hdr->gtpu_hdr.pdu_number = 0x00;
gtpu_ext_hdr->gtpu_hdr.sequence = 0x00;
gtpu_ext_hdr->gtpu_hdr.next_ext_type = GTPU_PDU_SESSION_CONTAINER;
gtpu_ext_hdr->message_length = 0x01;
gtpu_ext_hdr->pdu_type = GTPU_DL_PDU_SESSION_INFORMATION;
gtpu_ext_hdr->qfi = 0x06;
gtpu_ext_hdr->next_ext_type = GTPU_NO_MORE_EXTENSION_HEADER;
udp_s.async_send_to(
reinterpret_cast<const char*>(gtpu_ext_hdr),
// payload_len + sizeof(struct gtpuhdr), peer_addr);
payload_len + sizeof(struct gtpu_ext_hdr), peer_addr);
}
//------------------------------------------------------------------------------
void gtpu_l4_stack::send_g_pdu(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment