blob: 30b1ff6aae6645d65097bf49a34af882be0ee150 [file] [log] [blame]
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +04001/* gprs_bssgp_pcu.h
Ivan Kluchnikov5c2f9fb2012-02-05 02:27:17 +04002 *
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +04003 * Copyright (C) 2012 Ivan Klyuchnikov
Ivan Kluchnikov5c2f9fb2012-02-05 02:27:17 +04004 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040019
20#ifndef GPRS_BSSGP_PCU_H
21#define GPRS_BSSGP_PCU_H
22
Ivan Kluchnikov5c2f9fb2012-02-05 02:27:17 +040023
24extern "C" {
25#include <osmocom/core/talloc.h>
26#include <osmocom/core/rate_ctr.h>
Ivan Kluchnikova9f1ff22012-05-24 22:25:06 +040027#include <osmocom/core/logging.h>
Harald Welted6790092012-06-18 12:21:03 +080028#include <osmocom/core/signal.h>
Ivan Kluchnikov5c2f9fb2012-02-05 02:27:17 +040029#include <osmocom/core/application.h>
Harald Welted6790092012-06-18 12:21:03 +080030#include <osmocom/gprs/gprs_ns.h>
31#include <osmocom/gprs/gprs_bssgp.h>
32#include <osmocom/gprs/gprs_msgb.h>
Ivan Kluchnikov5c2f9fb2012-02-05 02:27:17 +040033
Ivan Kluchnikov8aa4c522012-02-20 15:15:12 +040034int bssgp_tx_bvc_reset(struct bssgp_bvc_ctx *bctx, uint16_t bvci, uint8_t cause);
Ivan Kluchnikov5c2f9fb2012-02-05 02:27:17 +040035
36int bssgp_tx_ul_ud(struct bssgp_bvc_ctx *bctx, uint32_t tlli, const uint8_t *qos_profile, struct msgb *llc_pdu);
37
38struct bssgp_bvc_ctx *btsctx_alloc(uint16_t bvci, uint16_t nsei);
39}
Ivan Kluchnikova9f1ff22012-05-24 22:25:06 +040040#include <gprs_debug.h>
Ivan Kluchnikov5c2f9fb2012-02-05 02:27:17 +040041
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040042#define BVCI 7
43#define NSEI 3
Ivan Kluchnikov5c2f9fb2012-02-05 02:27:17 +040044
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040045#define QOS_PROFILE 0
Ivan Kluchnikov3fa42b22012-06-04 19:07:25 +040046#define BSSGP_HDR_LEN 53
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040047#define NS_HDR_LEN 4
48#define MAX_LEN_PDU 60
Ivan Kluchnikovb172b1b2012-06-07 01:51:49 +040049#define IE_LLC_PDU 14
Ivan Kluchnikova21f2752012-05-24 22:35:19 +040050#define BLOCK_DATA_LEN 20
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040051#define BLOCK_LEN 23
Ivan Kluchnikov5c2f9fb2012-02-05 02:27:17 +040052
Andreas Eversbergfe411b32012-06-23 19:35:56 +020053#define CELL_ID 0
Andreas Eversberg5dac2f02012-06-27 15:52:04 +020054#define MNC 2
55#define MCC 262
Andreas Eversbergfe411b32012-06-23 19:35:56 +020056#define PCU_LAC 1
57#define PCU_RAC 0
Ivan Kluchnikov5c2f9fb2012-02-05 02:27:17 +040058
Ivan Kluchnikov5c2f9fb2012-02-05 02:27:17 +040059
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040060extern struct bssgp_bvc_ctx *bctx;
Ivan Kluchnikov5c2f9fb2012-02-05 02:27:17 +040061
Ivan Kluchnikov5e0df932012-06-12 15:33:52 +040062int gprs_bssgp_pcu_rx_dl_ud(struct msgb *msg, struct tlv_parsed *tp);
Ivan Kluchnikov5c2f9fb2012-02-05 02:27:17 +040063
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040064int gprs_bssgp_pcu_rx_ptp(struct msgb *msg, struct tlv_parsed *tp, struct bssgp_bvc_ctx *bctx);
Ivan Kluchnikov5c2f9fb2012-02-05 02:27:17 +040065
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040066int gprs_bssgp_pcu_rx_sign(struct msgb *msg, struct tlv_parsed *tp, struct bssgp_bvc_ctx *bctx);
67
68int gprs_bssgp_pcu_rcvmsg(struct msgb *msg);
69
Andreas Eversbergbf5a0f62012-07-06 08:58:22 +020070int gprs_bssgp_create(uint32_t sgsn_ip, uint16_t sgsn_port, uint16_t nsei,
71 uint16_t nsvci, uint16_t bvci, uint16_t mcc, uint16_t mnc, uint16_t lac,
72 uint16_t rac, uint16_t cell_id);
73
74void gprs_bssgp_destroy(void);
75
Ivan Kluchnikov8ee60512012-03-05 19:24:57 +040076#endif // GPRS_BSSGP_PCU_H