open5gs/tests/common/test-packet.h

155 lines
6.3 KiB
C
Raw Normal View History

2019-06-18 06:32:01 +00:00
/*
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
2019-06-11 09:28:25 +00:00
#ifndef TEST_PACKET_H
#define TEST_PACKET_H
2017-03-05 06:02:12 +00:00
2019-06-11 09:28:25 +00:00
#include "asn1c/s1ap-message.h"
2017-03-05 06:02:12 +00:00
#ifdef __cplusplus
extern "C" {
2019-06-11 09:28:25 +00:00
#endif
2017-03-05 06:02:12 +00:00
2019-04-27 14:54:30 +00:00
int testpacket_init();
int testpacket_final();
2019-06-18 06:32:01 +00:00
ogs_socknode_t *testsctp_server(const char *ipstr);
ogs_socknode_t *testsctp_client(const char *ipstr);
2019-07-08 09:15:19 +00:00
ogs_pkbuf_t *testsctp_read(ogs_socknode_t *node, int type);
2019-06-18 06:32:01 +00:00
#define testenb_s1ap_client testsctp_client
2019-07-08 09:15:19 +00:00
#define testenb_s1ap_read(x) testsctp_read(x, 0);
2019-05-31 01:18:43 +00:00
int testenb_s1ap_send(ogs_socknode_t *node, ogs_pkbuf_t *sendbuf);
2019-06-18 06:32:01 +00:00
#define testenb_s1ap_close ogs_socknode_free
#define testvlr_sgsap_server testsctp_server
2019-07-08 09:15:19 +00:00
#define testvlr_sgsap_read(x) testsctp_read(x, 1);
2019-06-18 06:32:01 +00:00
int testvlr_sgsap_send(ogs_socknode_t *node, ogs_pkbuf_t *sendbuf);
#define testvlr_sgsap_close ogs_socknode_free
2017-03-05 06:02:12 +00:00
2019-05-30 12:14:54 +00:00
ogs_socknode_t *testenb_gtpu_server(const char *ipstr);
ogs_pkbuf_t *testenb_gtpu_read(ogs_socknode_t *node);
int testenb_gtpu_send(ogs_socknode_t *node, ogs_pkbuf_t *sendbuf);
void testenb_gtpu_close(ogs_socknode_t *node);
2017-03-05 06:02:12 +00:00
int tests1ap_build_invalid_packet(ogs_pkbuf_t **pkbuf, int i);
2019-04-27 14:54:30 +00:00
int tests1ap_build_setup_req(
ogs_pkbuf_t **pkbuf, S1AP_ENB_ID_PR present, uint32_t enb_id,
int tac, uint16_t mcc, uint16_t mnc, uint16_t mnc_len);
int tests1ap_build_initial_ue_msg(ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_identity_response(ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_authentication_response(
ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_authentication_failure(
ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_security_mode_complete(
ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_esm_information_response(
ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_ue_capability_info_indication(
ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_initial_context_setup_response(
ogs_pkbuf_t **pkbuf,
uint32_t mme_ue_s1ap_id, uint32_t enb_ue_s1ap_id,
uint8_t ebi, uint32_t teid, const char *ipstr);
2019-07-10 13:04:52 +00:00
int tests1ap_build_ue_context_modification_response(
ogs_pkbuf_t **pkbuf,
uint32_t mme_ue_s1ap_id, uint32_t enb_ue_s1ap_id);
2019-04-27 14:54:30 +00:00
int tests1ap_build_initial_context_setup_failure(
ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_attach_complete(ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_emm_status(ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_detach_request(ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_ue_context_release_request(
ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_ue_context_release_complete(
ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_service_request(ogs_pkbuf_t **pkbuf,
uint32_t enb_ue_s1ap_id, uint8_t seq,
uint16_t mac, uint32_t m_tmsi);
int tests1ap_build_tau_request(ogs_pkbuf_t **pkbuf, int i,
uint32_t mme_ue_s1ap_id, uint32_t enb_ue_s1ap_id, uint8_t active_flag,
uint32_t m_tmsi, uint8_t seq, uint32_t mac, uint8_t *knas_int);
2019-07-08 09:15:19 +00:00
int tests1ap_build_extended_service_request(ogs_pkbuf_t **pkbuf, int i,
uint8_t service_type, uint32_t m_tmsi, uint8_t seq, uint8_t *knas_int);
2019-04-27 14:54:30 +00:00
int tests1ap_build_pdn_connectivity_request(
ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_pdn_disconnectivity_request(
ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_e_rab_setup_response(
ogs_pkbuf_t **pkbuf,
uint32_t mme_ue_s1ap_id, uint32_t enb_ue_s1ap_id,
uint8_t ebi, uint32_t teid, const char *ipstr);
int tests1ap_build_e_rab_modify_response(
ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_e_rab_release_response(
ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_activate_default_bearer_accept(
ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_activate_dedicated_bearer_accept(
ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_modify_bearer_accept(
ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_deactivate_bearer_accept(
ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_path_switch_request(
ogs_pkbuf_t **pkbuf, int target,
uint32_t mme_ue_s1ap_id, uint32_t enb_ue_s1ap_id,
int num_of_bearer, uint8_t ebi, uint32_t teid,
const char *ipstr1, const char *ipstr2);
int tests1ap_build_handover_required(ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_handover_failure(ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_handover_request_ack(
ogs_pkbuf_t **pkbuf, int target,
uint32_t mme_ue_s1ap_id, uint32_t enb_ue_s1ap_id,
int num_of_bearer, uint8_t ebi, uint32_t teid,
const char *ipstr1, const char *ipstr2);
int tests1ap_build_handover_request_ack_static(
ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_enb_status_transfer(
ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_enb_configuration_transfer(
ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_handover_notify(ogs_pkbuf_t **pkbuf, int i);
int tests1ap_build_handover_cancel(ogs_pkbuf_t **pkbuf, int i);
2018-03-21 07:10:20 +00:00
2019-04-27 14:54:30 +00:00
int tests1ap_build_s1_reset(ogs_pkbuf_t **pkbuf, int i);
2017-12-16 09:06:34 +00:00
2019-07-13 02:51:28 +00:00
int tests1ap_build_uplink_nas_transport(ogs_pkbuf_t **pkbuf, int i);
2019-04-27 14:54:30 +00:00
int testgtpu_build_ping(ogs_pkbuf_t **sendbuf,
2017-12-16 09:06:34 +00:00
const char *src_ip, const char *dst_ip);
2019-04-27 14:54:30 +00:00
int testgtpu_build_slacc_rs(ogs_pkbuf_t **sendbuf, int i);
2017-12-16 09:06:34 +00:00
2019-06-21 15:28:21 +00:00
int testsgsap_location_update_accept(ogs_pkbuf_t **pkbuf, int i);
2019-07-05 06:55:07 +00:00
int testsgsap_location_update_reject(ogs_pkbuf_t **pkbuf, int i);
2019-07-05 09:13:32 +00:00
int testsgsap_imsi_detach_ack(ogs_pkbuf_t **pkbuf, int i);
2019-07-08 09:15:19 +00:00
int testsgsap_paging_request(ogs_pkbuf_t **pkbuf, int i);
2019-07-07 01:16:21 +00:00
int testsgsap_reset_indication(ogs_pkbuf_t **pkbuf, int i);
2019-07-13 05:51:35 +00:00
int testsgsap_release_request(ogs_pkbuf_t **pkbuf, int i);
2019-07-13 13:52:50 +00:00
int testsgsap_downlink_unitdata(ogs_pkbuf_t **pkbuf, int i);
int testsgsap_mm_information_request(ogs_pkbuf_t **pkbuf, int i);
2019-06-21 15:28:21 +00:00
2017-03-05 06:02:12 +00:00
#ifdef __cplusplus
}
2019-06-11 09:28:25 +00:00
#endif
2017-03-05 06:02:12 +00:00
2019-06-11 09:28:25 +00:00
#endif /* TEST_PACKET_H */