2010-07-27 19:32:52 +00:00
|
|
|
/*
|
2011-01-02 19:24:08 +00:00
|
|
|
* (C) 2010-2011 by Holger Hans Peter Freyther <zecke@selfish.org>
|
|
|
|
* (C) 2010-2011 by On-Waves
|
2010-07-27 19:32:52 +00:00
|
|
|
* All Rights Reserved
|
|
|
|
*
|
2011-01-16 16:45:14 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
2010-07-27 19:32:52 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2011-01-16 16:45:14 +00:00
|
|
|
* GNU Affero General Public License for more details.
|
2010-07-27 19:32:52 +00:00
|
|
|
*
|
2011-01-16 16:45:14 +00:00
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2010-07-27 19:32:52 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
#ifndef mtp_data_h
|
|
|
|
#define mtp_data_h
|
|
|
|
|
2010-07-30 21:25:35 +00:00
|
|
|
#include <osmocore/msgb.h>
|
|
|
|
#include <osmocore/timer.h>
|
|
|
|
#include <osmocore/utils.h>
|
2010-07-27 19:32:52 +00:00
|
|
|
|
2011-01-02 19:24:08 +00:00
|
|
|
struct bsc_data;
|
2011-01-17 10:54:39 +00:00
|
|
|
struct mtp_link;
|
2011-01-02 19:24:08 +00:00
|
|
|
|
2010-07-27 19:32:52 +00:00
|
|
|
/* MTP Level3 timers */
|
|
|
|
|
|
|
|
/* Timers for SS7 */
|
|
|
|
#define MTP_T1 12, 0
|
|
|
|
#define MTP_T2 30, 0
|
|
|
|
#define START_DELAY 8, 0
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The state of the mtp_link in terms of layer3 and upwards
|
|
|
|
*/
|
2011-01-02 17:47:49 +00:00
|
|
|
struct mtp_link_set {
|
2010-07-27 19:32:52 +00:00
|
|
|
/* routing info.. */
|
2011-01-01 12:34:58 +00:00
|
|
|
int dpc, opc, sccp_opc;
|
2010-11-26 20:05:39 +00:00
|
|
|
int ni;
|
2010-11-26 20:07:11 +00:00
|
|
|
int spare;
|
2010-07-27 19:32:52 +00:00
|
|
|
|
|
|
|
/* internal state */
|
|
|
|
/* the MTP1 link is up */
|
|
|
|
int available;
|
|
|
|
int running;
|
|
|
|
int sccp_up;
|
|
|
|
|
2011-01-02 17:11:37 +00:00
|
|
|
int last_sls;
|
|
|
|
|
2010-07-27 19:32:52 +00:00
|
|
|
/* misc data */
|
2010-07-30 20:37:26 +00:00
|
|
|
uint8_t test_ptrn[14];
|
2010-07-27 19:32:52 +00:00
|
|
|
|
|
|
|
int sltm_pending;
|
|
|
|
int sltm_once;
|
|
|
|
int was_up;
|
|
|
|
|
|
|
|
int slta_misses;
|
|
|
|
struct timer_list t1_timer;
|
|
|
|
struct timer_list t2_timer;
|
|
|
|
|
|
|
|
struct timer_list delay_timer;
|
2011-01-02 19:24:08 +00:00
|
|
|
|
2011-01-04 12:21:52 +00:00
|
|
|
struct llist_head links;
|
2011-01-17 10:54:39 +00:00
|
|
|
struct mtp_link *slc[16];
|
2011-01-03 22:51:07 +00:00
|
|
|
|
2011-01-02 19:24:08 +00:00
|
|
|
/* custom data */
|
|
|
|
struct bsc_data *bsc;
|
2010-07-27 19:32:52 +00:00
|
|
|
};
|
|
|
|
|
2011-01-17 10:54:39 +00:00
|
|
|
/**
|
|
|
|
* One physical link to somewhere. This is the base
|
|
|
|
* with the interface used by the mtp_link_set. There
|
|
|
|
* will be specific implementations for M2UA, UDP and
|
|
|
|
* other transport means.
|
|
|
|
*/
|
|
|
|
struct mtp_link {
|
|
|
|
struct llist_head entry;
|
|
|
|
|
|
|
|
int pcap_fd;
|
|
|
|
struct mtp_link_set *the_link;
|
|
|
|
|
|
|
|
int available;
|
|
|
|
|
|
|
|
struct timer_list link_activate;
|
|
|
|
|
|
|
|
int (*start)(struct mtp_link *);
|
|
|
|
int (*write)(struct mtp_link *, struct msgb *msg);
|
|
|
|
int (*shutdown)(struct mtp_link *);
|
|
|
|
int (*reset)(struct mtp_link *data);
|
|
|
|
int (*clear_queue)(struct mtp_link *data);
|
|
|
|
};
|
|
|
|
|
2010-07-27 19:32:52 +00:00
|
|
|
|
2011-01-02 17:47:49 +00:00
|
|
|
struct mtp_link_set *mtp_link_set_alloc(void);
|
|
|
|
void mtp_link_set_stop(struct mtp_link_set *link);
|
|
|
|
void mtp_link_set_reset(struct mtp_link_set *link);
|
|
|
|
int mtp_link_set_data(struct mtp_link_set *link, struct msgb *msg);
|
|
|
|
int mtp_link_set_submit_sccp_data(struct mtp_link_set *link, int sls, const uint8_t *data, unsigned int length);
|
|
|
|
int mtp_link_set_submit_isup_data(struct mtp_link_set *link, int sls, const uint8_t *data, unsigned int length);
|
2010-07-27 19:32:52 +00:00
|
|
|
|
2011-01-04 12:01:23 +00:00
|
|
|
void mtp_link_set_init_slc(struct mtp_link_set *set);
|
2011-01-17 10:54:39 +00:00
|
|
|
void mtp_link_set_add_link(struct mtp_link_set *set, struct mtp_link *link);
|
2011-01-04 12:01:23 +00:00
|
|
|
|
2010-07-27 19:32:52 +00:00
|
|
|
|
|
|
|
/* one time init function */
|
2011-01-02 17:47:49 +00:00
|
|
|
void mtp_link_set_init(void);
|
2010-07-27 19:32:52 +00:00
|
|
|
|
|
|
|
/* to be implemented for MSU sending */
|
2011-01-17 10:54:39 +00:00
|
|
|
void mtp_link_set_submit(struct mtp_link *link, struct msgb *msg);
|
2011-01-02 17:47:49 +00:00
|
|
|
void mtp_link_set_forward_sccp(struct mtp_link_set *link, struct msgb *msg, int sls);
|
2011-01-17 15:13:28 +00:00
|
|
|
void mtp_link_set_forward_isup(struct mtp_link_set *link, struct msgb *msg, int sls);
|
2011-01-17 10:54:39 +00:00
|
|
|
void mtp_link_restart(struct mtp_link *link);
|
2011-01-02 17:47:49 +00:00
|
|
|
void mtp_link_set_sccp_down(struct mtp_link_set *link);
|
2010-07-27 19:32:52 +00:00
|
|
|
|
|
|
|
#endif
|