3 * Copyright 2019 AT&T Intellectual Property
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
24 #include <x2reset_request_wrapper.h>
26 void test_build_pack_x2reset_request();
27 void test_unpack(void);
30 main(int argc, char* argv[])
32 test_build_pack_x2reset_request();
36 void test_build_pack_x2reset_request(){
37 size_t error_buf_size = 8192;
38 size_t packed_buf_size = 4096;
39 unsigned char responseDataBuf[packed_buf_size];
40 char responseErrorBuf[error_buf_size];
43 /**********************************************************************************/
45 packed_buf_size = 4096;
46 result = build_pack_x2reset_request(Cause_PR_radioNetwork,CauseRadioNetwork_time_critical_handover,
47 &packed_buf_size, responseDataBuf, error_buf_size, responseErrorBuf);
49 printf("#%s failed. Packing error %s\n", __func__, responseErrorBuf);
52 printf("#%s packed size:%lu\nPayload:\n", __func__, packed_buf_size);
53 for (size_t i = 0; i < packed_buf_size; ++i)
54 printf("%02x",responseDataBuf[i]);
57 pdu =calloc(1, sizeof(E2AP_PDU_t));
58 if (!unpack_pdu_aux(pdu, packed_buf_size, responseDataBuf,error_buf_size, responseErrorBuf,ATS_ALIGNED_BASIC_PER)){
59 printf("#%s failed. Packing error %s\n", __func__, responseErrorBuf);
61 responseErrorBuf[0] = 0;
62 asn1_pdu_printer(pdu, sizeof(responseErrorBuf), responseErrorBuf);
63 printf("#%s: %s\n", __func__, responseErrorBuf);