blob: 6e3d47357a5dad725c849e181ccf137a8d34180a [file] [log] [blame]
Harald Welte51b00a62014-04-03 09:37:38 -04001/* External interface functions of the library */
2
3/* (C) 2014 by sysmocom - s.f.m.c. GmbH
4 * Author: Pablo Neira Ayuso <pablo@gnumonks.org>
5 *
6 * All Rights Reserved
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 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 Affero 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 <http://www.gnu.org/licenses/>.
20 *
21 */
22
Pablo Neira Ayuso18532952014-02-22 22:09:59 +010023#include <stdlib.h>
24#include <netinet/in.h>
25
26#include <libgtpnl/gtp.h>
27
28#include "internal.h"
29
30struct gtp_tunnel *gtp_tunnel_alloc(void)
31{
32 return calloc(1, sizeof(struct gtp_tunnel));
33}
34EXPORT_SYMBOL(gtp_tunnel_alloc);
35
36void gtp_tunnel_free(struct gtp_tunnel *t)
37{
38 free(t);
39}
40EXPORT_SYMBOL(gtp_tunnel_free);
41
Andreas Schultz49773302016-04-11 16:09:56 +020042void gtp_tunnel_set_ifns(struct gtp_tunnel *t, int ifns)
43{
44 t->ifns = ifns;
45}
46EXPORT_SYMBOL(gtp_tunnel_set_ifns);
47
Pablo Neira Ayuso18532952014-02-22 22:09:59 +010048void gtp_tunnel_set_ifidx(struct gtp_tunnel *t, uint32_t ifidx)
49{
50 t->ifidx = ifidx;
51}
52EXPORT_SYMBOL(gtp_tunnel_set_ifidx);
53
54void gtp_tunnel_set_ms_ip4(struct gtp_tunnel *t, struct in_addr *ms_addr)
55{
56 t->ms_addr = *ms_addr;
57}
58EXPORT_SYMBOL(gtp_tunnel_set_ms_ip4);
59
60void gtp_tunnel_set_sgsn_ip4(struct gtp_tunnel *t, struct in_addr *sgsn_addr)
61{
62 t->sgsn_addr = *sgsn_addr;
63}
64EXPORT_SYMBOL(gtp_tunnel_set_sgsn_ip4);
65
66void gtp_tunnel_set_version(struct gtp_tunnel *t, uint32_t version)
67{
68 t->gtp_version = version;
69}
70EXPORT_SYMBOL(gtp_tunnel_set_version);
71
72void gtp_tunnel_set_tid(struct gtp_tunnel *t, uint64_t tid)
73{
74 t->tid = tid;
75}
76EXPORT_SYMBOL(gtp_tunnel_set_tid);
77
Pablo Neira Ayusob976ffa2014-03-20 13:56:55 +010078void gtp_tunnel_set_flowid(struct gtp_tunnel *t, uint16_t flowid)
79{
80 t->flowid = flowid;
81}
82EXPORT_SYMBOL(gtp_tunnel_set_flowid);
83
Andreas Schultz49773302016-04-11 16:09:56 +020084const int gtp_tunnel_get_ifns(struct gtp_tunnel *t)
85{
86 return t->ifns;
87}
88EXPORT_SYMBOL(gtp_tunnel_get_ifns);
89
Pablo Neira Ayuso18532952014-02-22 22:09:59 +010090const uint32_t gtp_tunnel_get_ifidx(struct gtp_tunnel *t)
91{
92 return t->ifidx;
93}
94EXPORT_SYMBOL(gtp_tunnel_get_ifidx);
95
96const struct in_addr *gtp_tunnel_get_ms_ip4(struct gtp_tunnel *t)
97{
98 return &t->ms_addr;
99}
100EXPORT_SYMBOL(gtp_tunnel_get_ms_ip4);
101
102const struct in_addr *gtp_tunnel_get_sgsn_ip4(struct gtp_tunnel *t)
103{
104 return &t->sgsn_addr;
105}
106EXPORT_SYMBOL(gtp_tunnel_get_sgsn_ip4);
107
108int gtp_tunnel_get_version(struct gtp_tunnel *t)
109{
110 return t->gtp_version;
111}
112EXPORT_SYMBOL(gtp_tunnel_get_version);
113
114uint64_t gtp_tunnel_get_tid(struct gtp_tunnel *t)
115{
116 return t->tid;
117}
118EXPORT_SYMBOL(gtp_tunnel_get_tid);
Pablo Neira Ayusob976ffa2014-03-20 13:56:55 +0100119
120uint16_t gtp_tunnel_get_flowid(struct gtp_tunnel *t)
121{
122 return t->flowid;
123}
124EXPORT_SYMBOL(gtp_tunnel_get_flowid);