blob: 66c1a9c255f321f1af78f3addbc81478cdff7c76 [file] [log] [blame]
Harald Weltee72cf552016-04-28 07:18:49 +02001#pragma once
2
3#include <osmocom/core/linuxlist.h>
4#include <osmocom/core/msgb.h>
5#include <osmocom/abis/ipa.h>
6#include <osmocom/abis/ipaccess.h>
Stefan Sperling93c5b102018-04-10 19:26:14 +02007#include <osmocom/gsm/gsup.h>
Harald Weltee72cf552016-04-28 07:18:49 +02008
9struct osmo_gsup_conn;
10
11/* Expects message in msg->l2h */
12typedef int (*osmo_gsup_read_cb_t)(struct osmo_gsup_conn *conn, struct msgb *msg);
13
14struct osmo_gsup_server {
15 /* list of osmo_gsup_conn */
16 struct llist_head clients;
17
Max9cacb6f2017-02-20 17:22:56 +010018 /* lu_operations list */
19 struct llist_head *luop;
20
Harald Weltee72cf552016-04-28 07:18:49 +020021 struct ipa_server_link *link;
22 osmo_gsup_read_cb_t read_cb;
Harald Weltee687be52016-05-03 18:49:27 +020023 struct llist_head routes;
Harald Weltee72cf552016-04-28 07:18:49 +020024};
25
26
27/* a single connection to a given client (SGSN, MSC) */
28struct osmo_gsup_conn {
29 struct llist_head list;
30
31 struct osmo_gsup_server *server;
32 struct ipa_server_conn *conn;
33 //struct oap_state oap_state;
Harald Weltee687be52016-05-03 18:49:27 +020034 struct tlv_parsed ccm;
Neels Hofmeyrcab2fcd2017-03-15 00:07:43 +010035
36 unsigned int auc_3g_ind; /*!< IND index used for UMTS AKA SQN */
Stefan Sperling93c5b102018-04-10 19:26:14 +020037
38 /* Set when Location Update is received: */
39 bool supports_cs; /* client supports OSMO_GSUP_CN_DOMAIN_CS */
40 bool supports_ps; /* client supports OSMO_GSUP_CN_DOMAIN_PS */
Harald Weltee72cf552016-04-28 07:18:49 +020041};
42
43
44int osmo_gsup_conn_send(struct osmo_gsup_conn *conn, struct msgb *msg);
Neels Hofmeyr6eed3222016-12-11 01:21:49 +010045int osmo_gsup_conn_ccm_get(const struct osmo_gsup_conn *clnt, uint8_t **addr,
46 uint8_t tag);
Harald Weltee72cf552016-04-28 07:18:49 +020047
48struct osmo_gsup_server *osmo_gsup_server_create(void *ctx,
Max9cacb6f2017-02-20 17:22:56 +010049 const char *ip_addr,
50 uint16_t tcp_port,
51 osmo_gsup_read_cb_t read_cb,
52 struct llist_head *lu_op_lst);
Harald Weltee72cf552016-04-28 07:18:49 +020053
54void osmo_gsup_server_destroy(struct osmo_gsup_server *gsups);
55
Neels Hofmeyr1b8a1dc2018-05-04 16:46:47 +020056int osmo_gsup_configure_wildcard_apn(struct osmo_gsup_message *gsup,
57 uint8_t *apn_buf, size_t apn_buf_size);