blob: 9c4d4836605ba408b43e794e74e5b78c5dc973d5 [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
Stefan Sperlingf83432c2018-05-03 14:26:59 +02009#ifndef OSMO_GSUP_MAX_CALLED_PARTY_BCD_LEN
10#define OSMO_GSUP_MAX_CALLED_PARTY_BCD_LEN 43 /* TS 24.008 10.5.4.7 */
11#endif
12
Harald Weltee72cf552016-04-28 07:18:49 +020013struct osmo_gsup_conn;
14
15/* Expects message in msg->l2h */
16typedef int (*osmo_gsup_read_cb_t)(struct osmo_gsup_conn *conn, struct msgb *msg);
17
18struct osmo_gsup_server {
Harald Welte32acace2018-06-16 17:07:28 +020019 /* private data of the application/user */
20 void *priv;
21
Harald Weltee72cf552016-04-28 07:18:49 +020022 /* list of osmo_gsup_conn */
23 struct llist_head clients;
24
Max9cacb6f2017-02-20 17:22:56 +010025 /* lu_operations list */
26 struct llist_head *luop;
27
Harald Weltee72cf552016-04-28 07:18:49 +020028 struct ipa_server_link *link;
29 osmo_gsup_read_cb_t read_cb;
Harald Weltee687be52016-05-03 18:49:27 +020030 struct llist_head routes;
Harald Weltee72cf552016-04-28 07:18:49 +020031};
32
33
34/* a single connection to a given client (SGSN, MSC) */
35struct osmo_gsup_conn {
36 struct llist_head list;
37
38 struct osmo_gsup_server *server;
39 struct ipa_server_conn *conn;
40 //struct oap_state oap_state;
Harald Weltee687be52016-05-03 18:49:27 +020041 struct tlv_parsed ccm;
Neels Hofmeyrcab2fcd2017-03-15 00:07:43 +010042
43 unsigned int auc_3g_ind; /*!< IND index used for UMTS AKA SQN */
Stefan Sperling93c5b102018-04-10 19:26:14 +020044
45 /* Set when Location Update is received: */
46 bool supports_cs; /* client supports OSMO_GSUP_CN_DOMAIN_CS */
47 bool supports_ps; /* client supports OSMO_GSUP_CN_DOMAIN_PS */
Harald Weltee72cf552016-04-28 07:18:49 +020048};
49
50
51int osmo_gsup_conn_send(struct osmo_gsup_conn *conn, struct msgb *msg);
Neels Hofmeyr6eed3222016-12-11 01:21:49 +010052int osmo_gsup_conn_ccm_get(const struct osmo_gsup_conn *clnt, uint8_t **addr,
53 uint8_t tag);
Harald Weltee72cf552016-04-28 07:18:49 +020054
55struct osmo_gsup_server *osmo_gsup_server_create(void *ctx,
Max9cacb6f2017-02-20 17:22:56 +010056 const char *ip_addr,
57 uint16_t tcp_port,
58 osmo_gsup_read_cb_t read_cb,
Harald Welte32acace2018-06-16 17:07:28 +020059 struct llist_head *lu_op_lst,
60 void *priv);
Harald Weltee72cf552016-04-28 07:18:49 +020061
62void osmo_gsup_server_destroy(struct osmo_gsup_server *gsups);
63
Neels Hofmeyr1b8a1dc2018-05-04 16:46:47 +020064int osmo_gsup_configure_wildcard_apn(struct osmo_gsup_message *gsup,
65 uint8_t *apn_buf, size_t apn_buf_size);
Stefan Sperlingf83432c2018-05-03 14:26:59 +020066int osmo_gsup_create_insert_subscriber_data_msg(struct osmo_gsup_message *gsup, const char *imsi, const char *msisdn,
67 uint8_t *msisdn_enc, size_t msisdn_enc_size,
68 uint8_t *apn_buf, size_t apn_buf_size,
69 enum osmo_gsup_cn_domain cn_domain);