File size: 5,686 Bytes
258fb37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
/*
 * Copyright (C) 2019,2020 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/>.
 */

#include "test-common.h"

#define TEST_SGSAP_MAX_MESSAGE 64

ogs_pkbuf_t *test_sgsap_location_update_accept(int i)
{
    ogs_pkbuf_t *pkbuf = NULL;
    const char *payload[TEST_SGSAP_MAX_MESSAGE] = {
        "0a01089999073746 000006040509f107 09260e05f49ee88e 64",
        "0a01087942120000 000030040527f412 c9580e05f437ab9c c5",
        "",

    };
    uint16_t len[TEST_SGSAP_MAX_MESSAGE] = {
        25,
        25,
        0,
    };
    char hexbuf[OGS_HUGE_LEN];

    pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
    ogs_assert(pkbuf);
    ogs_pkbuf_put_data(pkbuf,
        ogs_hex_from_string(payload[i], hexbuf, sizeof(hexbuf)), len[i]);

    return pkbuf;
}

ogs_pkbuf_t *test_sgsap_location_update_reject(int i)
{
    ogs_pkbuf_t *pkbuf = NULL;
    const char *payload[TEST_SGSAP_MAX_MESSAGE] = {
        "0b01089999073746 0000060f01030405 09f1070926",
        "",
        "",

    };
    uint16_t len[TEST_SGSAP_MAX_MESSAGE] = {
        21,
        0,
        0,
    };
    char hexbuf[OGS_HUGE_LEN];

    pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
    ogs_assert(pkbuf);
    ogs_pkbuf_put_data(pkbuf,
        ogs_hex_from_string(payload[i], hexbuf, sizeof(hexbuf)), len[i]);

    return pkbuf;
}

ogs_pkbuf_t *test_sgsap_imsi_detach_ack(int i)
{
    ogs_pkbuf_t *pkbuf = NULL;
    const char *payload[TEST_SGSAP_MAX_MESSAGE] = {
        "1401089999073746 000006",
        "",
        "",

    };
    uint16_t len[TEST_SGSAP_MAX_MESSAGE] = {
        11,
        0,
        0,
    };
    char hexbuf[OGS_HUGE_LEN];

    pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
    ogs_assert(pkbuf);
    ogs_pkbuf_put_data(pkbuf,
        ogs_hex_from_string(payload[i], hexbuf, sizeof(hexbuf)), len[i]);

    return pkbuf;
}

ogs_pkbuf_t *test_sgsap_paging_request(int i)
{
    ogs_pkbuf_t *pkbuf = NULL;
    const char *payload[TEST_SGSAP_MAX_MESSAGE] = {
        "0101089999073746 000006021003766c 72076578616d706c 65036e6574200101"
        "040509f1070926",
        "0101089999073746 000005021003766c 72076578616d706c 65036e6574200101"
        "040509f1070926",  /* Paging-Reject */
        "0101089999073746 000006021003766c 72076578616d706c 65036e6574200102"
        "040509f1070926",  /* Paging-Request with SMS */

        /* Paging-Request for crash-test */
        "0101089999073746 000006021003766c 72076578616d706c 65036e6574200101"
        "040527f412c958",
        "",
        "",
    };
    uint16_t len[TEST_SGSAP_MAX_MESSAGE] = {
        39,
        39,
        39,

        39,
        0,
        0,
    };
    char hexbuf[OGS_HUGE_LEN];

    pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
    ogs_assert(pkbuf);
    ogs_pkbuf_put_data(pkbuf,
        ogs_hex_from_string(payload[i], hexbuf, sizeof(hexbuf)), len[i]);

    return pkbuf;
}

ogs_pkbuf_t *test_sgsap_reset_indication(int i)
{
    ogs_pkbuf_t *pkbuf = NULL;
    const char *payload[TEST_SGSAP_MAX_MESSAGE] = {
        "15021003766c7207 6578616d706c6503 6e6574",
        "",
        "",

    };
    uint16_t len[TEST_SGSAP_MAX_MESSAGE] = {
        19,
        0,
        0,
    };
    char hexbuf[OGS_HUGE_LEN];

    pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
    ogs_assert(pkbuf);
    ogs_pkbuf_put_data(pkbuf,
        ogs_hex_from_string(payload[i], hexbuf, sizeof(hexbuf)), len[i]);

    return pkbuf;
}

ogs_pkbuf_t *test_sgsap_release_request(int i)
{
    ogs_pkbuf_t *pkbuf = NULL;
    const char *payload[TEST_SGSAP_MAX_MESSAGE] = {
        "1b01089999073746 000006",
        "",
        "",

    };
    uint16_t len[TEST_SGSAP_MAX_MESSAGE] = {
        11,
        0,
        0,
    };
    char hexbuf[OGS_HUGE_LEN];

    pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
    ogs_assert(pkbuf);
    ogs_pkbuf_put_data(pkbuf,
        ogs_hex_from_string(payload[i], hexbuf, sizeof(hexbuf)), len[i]);

    return pkbuf;
}

ogs_pkbuf_t *test_sgsap_downlink_unitdata(int i)
{
    ogs_pkbuf_t *pkbuf = NULL;
    const char *payload[TEST_SGSAP_MAX_MESSAGE] = {
        "0701089999073746 0000061626090123 0100079144775810 0650001700048032"
        "2400009160404044 150009c8329bfd06 4d9b53",

    };
    uint16_t len[TEST_SGSAP_MAX_MESSAGE] = {
        51,
    };
    char hexbuf[OGS_HUGE_LEN];

    pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
    ogs_assert(pkbuf);
    ogs_pkbuf_put_data(pkbuf,
        ogs_hex_from_string(payload[i], hexbuf, sizeof(hexbuf)), len[i]);

    return pkbuf;
}

ogs_pkbuf_t *test_sgsap_mm_information_request(int i)
{
    ogs_pkbuf_t *pkbuf = NULL;
    const char *payload[TEST_SGSAP_MAX_MESSAGE] = {
        "1a01087942120000 0000301714430483 d46413450483d464 1347917071028401"
        "29",

    };
    uint16_t len[TEST_SGSAP_MAX_MESSAGE] = {
        33,
    };
    char hexbuf[OGS_HUGE_LEN];

    pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
    ogs_assert(pkbuf);
    ogs_pkbuf_put_data(pkbuf,
        ogs_hex_from_string(payload[i], hexbuf, sizeof(hexbuf)), len[i]);

    return pkbuf;
}