/src/open5gs/lib/gtp/v1/build.c
Line  | Count  | Source  | 
1  |  | /*  | 
2  |  |  * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>  | 
3  |  |  * Copyright (C) 2022 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>  | 
4  |  |  * Copyright (C) 2023 Sukchan Lee <acetcom@gmail.com>  | 
5  |  |  *  | 
6  |  |  * This file is part of Open5GS.  | 
7  |  |  *  | 
8  |  |  * This program is free software: you can redistribute it and/or modify  | 
9  |  |  * it under the terms of the GNU Affero General Public License as published by  | 
10  |  |  * the Free Software Foundation, either version 3 of the License, or  | 
11  |  |  * (at your option) any later version.  | 
12  |  |  *  | 
13  |  |  * This program is distributed in the hope that it will be useful,  | 
14  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of  | 
15  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  | 
16  |  |  * GNU General Public License for more details.  | 
17  |  |  *  | 
18  |  |  * You should have received a copy of the GNU General Public License  | 
19  |  |  * along with this program.  If not, see <https://www.gnu.org/licenses/>.  | 
20  |  |  */  | 
21  |  |  | 
22  |  | #include "ogs-gtp.h"  | 
23  |  |  | 
24  |  | ogs_pkbuf_t *ogs_gtp1_build_echo_request(uint8_t type)  | 
25  | 0  | { | 
26  | 0  |     ogs_gtp1_message_t gtp1_message;  | 
27  |  | 
  | 
28  | 0  |     memset(>p1_message, 0, sizeof(ogs_gtp1_message_t));  | 
29  |  | 
  | 
30  | 0  |     gtp1_message.h.type = type;  | 
31  | 0  |     return ogs_gtp1_build_msg(>p1_message);  | 
32  | 0  | }  | 
33  |  |  | 
34  |  | ogs_pkbuf_t *ogs_gtp1_build_echo_response(  | 
35  |  |         uint8_t type, uint8_t recovery)  | 
36  | 0  | { | 
37  | 0  |     ogs_gtp1_message_t gtp1_message;  | 
38  | 0  |     ogs_gtp1_echo_response_t *rsp = NULL;  | 
39  |  | 
  | 
40  | 0  |     rsp = >p1_message.echo_response;  | 
41  | 0  |     memset(>p1_message, 0, sizeof(ogs_gtp1_message_t));  | 
42  |  | 
  | 
43  | 0  |     rsp->recovery.presence = 1;  | 
44  | 0  |     rsp->recovery.u8 = recovery;  | 
45  |  | 
  | 
46  | 0  |     gtp1_message.h.type = type;  | 
47  | 0  |     return ogs_gtp1_build_msg(>p1_message);  | 
48  | 0  | }  |