Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 1 | /* gprs_bssgp_pcu.h |
Ivan Kluchnikov | 5c2f9fb | 2012-02-05 02:27:17 +0400 | [diff] [blame] | 2 | * |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 3 | * Copyright (C) 2012 Ivan Klyuchnikov |
Holger Hans Peter Freyther | c0f1644 | 2013-08-22 08:40:33 +0200 | [diff] [blame] | 4 | * Copyright (C) 2013 by Holger Hans Peter Freyther |
Ivan Kluchnikov | 5c2f9fb | 2012-02-05 02:27:17 +0400 | [diff] [blame] | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * as published by the Free Software Foundation; either version 2 |
| 9 | * of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 | */ |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 20 | |
| 21 | #ifndef GPRS_BSSGP_PCU_H |
| 22 | #define GPRS_BSSGP_PCU_H |
| 23 | |
Ivan Kluchnikov | 5c2f9fb | 2012-02-05 02:27:17 +0400 | [diff] [blame] | 24 | |
| 25 | extern "C" { |
| 26 | #include <osmocom/core/talloc.h> |
| 27 | #include <osmocom/core/rate_ctr.h> |
Ivan Kluchnikov | a9f1ff2 | 2012-05-24 22:25:06 +0400 | [diff] [blame] | 28 | #include <osmocom/core/logging.h> |
Harald Welte | d679009 | 2012-06-18 12:21:03 +0800 | [diff] [blame] | 29 | #include <osmocom/core/signal.h> |
Ivan Kluchnikov | 5c2f9fb | 2012-02-05 02:27:17 +0400 | [diff] [blame] | 30 | #include <osmocom/core/application.h> |
Harald Welte | d679009 | 2012-06-18 12:21:03 +0800 | [diff] [blame] | 31 | #include <osmocom/gprs/gprs_ns.h> |
| 32 | #include <osmocom/gprs/gprs_bssgp.h> |
Andreas Eversberg | 4b39dd1 | 2012-09-23 05:03:56 +0200 | [diff] [blame] | 33 | #include <osmocom/gprs/gprs_bssgp_bss.h> |
Harald Welte | d679009 | 2012-06-18 12:21:03 +0800 | [diff] [blame] | 34 | #include <osmocom/gprs/gprs_msgb.h> |
Ivan Kluchnikov | 5c2f9fb | 2012-02-05 02:27:17 +0400 | [diff] [blame] | 35 | |
Ivan Kluchnikov | 5c2f9fb | 2012-02-05 02:27:17 +0400 | [diff] [blame] | 36 | struct bssgp_bvc_ctx *btsctx_alloc(uint16_t bvci, uint16_t nsei); |
| 37 | } |
Ivan Kluchnikov | a9f1ff2 | 2012-05-24 22:25:06 +0400 | [diff] [blame] | 38 | #include <gprs_debug.h> |
Ivan Kluchnikov | 5c2f9fb | 2012-02-05 02:27:17 +0400 | [diff] [blame] | 39 | |
Andreas Eversberg | 4b39dd1 | 2012-09-23 05:03:56 +0200 | [diff] [blame] | 40 | #define QOS_PROFILE 4 |
Ivan Kluchnikov | 3fa42b2 | 2012-06-04 19:07:25 +0400 | [diff] [blame] | 41 | #define BSSGP_HDR_LEN 53 |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 42 | #define NS_HDR_LEN 4 |
Ivan Kluchnikov | b172b1b | 2012-06-07 01:51:49 +0400 | [diff] [blame] | 43 | #define IE_LLC_PDU 14 |
Ivan Kluchnikov | 5c2f9fb | 2012-02-05 02:27:17 +0400 | [diff] [blame] | 44 | |
Holger Hans Peter Freyther | 67ed34e | 2013-10-17 17:01:54 +0200 | [diff] [blame] | 45 | struct gprs_rlcmac_bts; |
| 46 | |
Holger Hans Peter Freyther | e8d9a5f | 2013-07-28 19:11:20 +0200 | [diff] [blame] | 47 | struct gprs_bssgp_pcu { |
| 48 | struct gprs_nsvc *nsvc; |
| 49 | struct bssgp_bvc_ctx *bctx; |
| 50 | |
| 51 | struct gprs_rlcmac_bts *bts; |
| 52 | |
| 53 | struct osmo_timer_list bvc_timer; |
| 54 | |
| 55 | int nsvc_unblocked; |
| 56 | |
| 57 | int bvc_sig_reset; |
| 58 | int bvc_reset; |
| 59 | int bvc_unblocked; |
| 60 | int exit_on_destroy; |
Holger Hans Peter Freyther | c0f1644 | 2013-08-22 08:40:33 +0200 | [diff] [blame] | 61 | |
| 62 | /** callbacks below */ |
| 63 | |
| 64 | /* The BSSGP has been unblocked */ |
| 65 | void (*on_unblock_ack)(struct gprs_bssgp_pcu *pcu); |
Holger Hans Peter Freyther | 416ce69 | 2013-08-22 08:44:04 +0200 | [diff] [blame] | 66 | |
| 67 | /* When BSSGP data arrives. The msgb is not only for reference */ |
| 68 | void (*on_dl_unit_data)(struct gprs_bssgp_pcu *pcu, struct msgb *msg, |
| 69 | struct tlv_parsed *tp); |
Holger Hans Peter Freyther | e8d9a5f | 2013-07-28 19:11:20 +0200 | [diff] [blame] | 70 | }; |
| 71 | |
| 72 | struct gprs_bssgp_pcu *gprs_bssgp_create_and_connect(struct gprs_rlcmac_bts *bts, |
| 73 | uint16_t local_port, |
Holger Hans Peter Freyther | b67a8a3 | 2013-07-28 18:55:14 +0200 | [diff] [blame] | 74 | uint32_t sgsn_ip, uint16_t sgsn_port, uint16_t nsei, |
| 75 | uint16_t nsvci, uint16_t bvci, uint16_t mcc, uint16_t mnc, |
| 76 | uint16_t lac, uint16_t rac, uint16_t cell_id); |
Andreas Eversberg | bf5a0f6 | 2012-07-06 08:58:22 +0200 | [diff] [blame] | 77 | |
Holger Hans Peter Freyther | a30f476 | 2013-07-11 16:13:38 +0200 | [diff] [blame] | 78 | void gprs_bssgp_exit_on_destroy(void); |
| 79 | void gprs_bssgp_destroy_or_exit(void); |
Andreas Eversberg | bf5a0f6 | 2012-07-06 08:58:22 +0200 | [diff] [blame] | 80 | |
Holger Hans Peter Freyther | 90692f9 | 2013-07-13 12:51:16 +0200 | [diff] [blame] | 81 | struct bssgp_bvc_ctx *gprs_bssgp_pcu_current_bctx(void); |
| 82 | |
Ivan Kluchnikov | 8ee6051 | 2012-03-05 19:24:57 +0400 | [diff] [blame] | 83 | #endif // GPRS_BSSGP_PCU_H |