diff options
Diffstat (limited to 'include/osmocom/abis')
-rw-r--r-- | include/osmocom/abis/e1_input.h | 38 | ||||
-rw-r--r-- | include/osmocom/abis/ipa.h | 6 | ||||
-rw-r--r-- | include/osmocom/abis/lapd.h | 9 | ||||
-rw-r--r-- | include/osmocom/abis/lapd_pcap.h | 4 | ||||
-rw-r--r-- | include/osmocom/abis/unixsocket_proto.h | 31 |
5 files changed, 83 insertions, 5 deletions
diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h index e5d2991..1a701f9 100644 --- a/include/osmocom/abis/e1_input.h +++ b/include/osmocom/abis/e1_input.h @@ -21,6 +21,7 @@ enum e1inp_sign_type { E1INP_SIGN_OSMO, /* IPA CCM OSMO sub-type */ }; const char *e1inp_signtype_name(enum e1inp_sign_type tp); +extern const struct value_string e1inp_sign_type_names[5]; enum e1inp_ctr { E1I_CTR_HDLC_ABORT, @@ -63,8 +64,11 @@ enum e1inp_ts_type { E1INP_TS_TYPE_NONE, E1INP_TS_TYPE_SIGN, E1INP_TS_TYPE_TRAU, + E1INP_TS_TYPE_RAW, + E1INP_TS_TYPE_HDLC, }; const char *e1inp_tstype_name(enum e1inp_ts_type tp); +extern const struct value_string e1inp_ts_type_names[6]; /* A timeslot in the E1 interface */ struct e1inp_ts { @@ -92,6 +96,18 @@ struct e1inp_ts { /* subchannel muxer for frames to E1 */ struct subch_mux mux; } trau; + struct { + /* call-back for every received frame */ + void (*recv_cb)(struct e1inp_ts *ts, struct msgb *msg); + /* queue of pending to-be-transmitted msgbs */ + struct llist_head tx_queue; + } raw; + struct { + /* call-back for every received frame */ + void (*recv_cb)(struct e1inp_ts *ts, struct msgb *msg); + /* queue of pending to-be-transmitted msgbs */ + struct llist_head tx_queue; + } hdlc; }; union { struct { @@ -139,6 +155,7 @@ struct e1inp_driver { void (*vty_show)(struct vty *vty, struct e1inp_line *line); int default_delay; int has_keepalive; + const char *bind_addr; }; struct e1inp_line_ops { @@ -166,6 +183,7 @@ struct e1inp_line { unsigned int num; const char *name; unsigned int port_nr; + char *sock_path; struct rate_ctr_group *rate_ctr; /* keepalive configuration */ @@ -194,15 +212,14 @@ enum e1inp_signal_input { S_L_INP_LINE_NOALARM, }; +extern const struct value_string e1inp_signal_names[]; + /* register a driver with the E1 core */ int e1inp_driver_register(struct e1inp_driver *drv); /* fine a previously registered driver */ struct e1inp_driver *e1inp_driver_find(const char *name); -/* register a line with the E1 core */ -int e1inp_line_register(struct e1inp_line *line); - /* get a line by its ID */ struct e1inp_line *e1inp_line_find(uint8_t e1_nr); @@ -240,8 +257,15 @@ int e1inp_ts_config_trau(struct e1inp_ts *ts, struct e1inp_line *line, int (*trau_rcv_cb)(struct subch_demux *dmx, int ch, uint8_t *data, int len, void *_priv)); -/* Call from the Stack: configuration of this TS has changed */ -int e1inp_update_ts(struct e1inp_ts *ts); +/* configure and initialize one timeslot dedicated to RAW frames */ +int e1inp_ts_config_raw(struct e1inp_ts *ts, struct e1inp_line *line, + void (*raw_recv_cb)(struct e1inp_ts *ts, + struct msgb *msg)); + +/* configure and initialize one timeslot dedicated to HDLC frames */ +int e1inp_ts_config_hdlc(struct e1inp_ts *ts, struct e1inp_line *line, + void (*hdlc_recv_cb)(struct e1inp_ts *ts, + struct msgb *msg)); /* Receive a packet from the E1 driver */ int e1inp_rx_ts(struct e1inp_ts *ts, struct msgb *msg, @@ -282,6 +306,9 @@ int e1inp_vty_init(void); struct gsm_network; int ipaccess_setup(struct gsm_network *gsmnet); +/* activate superchannel or deactive to use timeslots. only valid for unixsocket driver */ +void e1inp_ericsson_set_altc(struct e1inp_line *unixlinue, int superchannel); + extern struct llist_head e1inp_driver_list; extern struct llist_head e1inp_line_list; @@ -290,6 +317,7 @@ struct input_signal_data { int link_type; uint8_t tei; uint8_t sapi; + uint8_t ts_nr; struct gsm_bts_trx *trx; struct e1inp_line *line; }; diff --git a/include/osmocom/abis/ipa.h b/include/osmocom/abis/ipa.h index 6e9f9dd..a157889 100644 --- a/include/osmocom/abis/ipa.h +++ b/include/osmocom/abis/ipa.h @@ -35,9 +35,14 @@ struct ipa_server_conn { struct osmo_fd ofd; struct llist_head tx_queue; int (*closed_cb)(struct ipa_server_conn *peer); + int (*ccm_cb)(struct ipa_server_conn *peer, struct msgb *msg, + struct tlv_parsed *tlvp, struct ipaccess_unit *ud); int (*cb)(struct ipa_server_conn *peer, struct msgb *msg); void *data; struct msgb *pending_msg; + /* remote address information */ + const char *addr; + uint16_t port; }; struct ipa_server_conn * @@ -48,6 +53,7 @@ ipa_server_conn_create(void *ctx, struct ipa_server_link *link, int fd, void ipa_server_conn_destroy(struct ipa_server_conn *peer); void ipa_server_conn_send(struct ipa_server_conn *peer, struct msgb *msg); +int ipa_server_conn_ccm(struct ipa_server_conn *conn, struct msgb *msg); enum ipa_client_conn_state { IPA_CLIENT_LINK_STATE_NONE = 0, diff --git a/include/osmocom/abis/lapd.h b/include/osmocom/abis/lapd.h index 2987633..d618187 100644 --- a/include/osmocom/abis/lapd.h +++ b/include/osmocom/abis/lapd.h @@ -18,8 +18,10 @@ struct lapd_profile { int short_address; }; +/* predefined lapd profiles (see lapd.c for definition) */ extern const struct lapd_profile lapd_profile_isdn; extern const struct lapd_profile lapd_profile_abis; +extern const struct lapd_profile lapd_profile_abis_ericsson; extern const struct lapd_profile lapd_profile_sat; struct lapd_instance { @@ -63,6 +65,13 @@ struct lapd_instance *lapd_instance_alloc(int network_side, void *rx_cbdata), void *rx_cbdata, const struct lapd_profile *profile); +/* In rare cases (e.g. Ericsson's lapd dialect), it may be necessary to + * exchange the lapd profile on the fly. lapd_instance_set_profile() + * allwos to set the lapd profile on a lapd instance danymically to + * one of the lapd profiles define above. */ +void lapd_instance_set_profile(struct lapd_instance *li, + const struct lapd_profile *profile); + void lapd_instance_free(struct lapd_instance *li); /* Start a (user-side) SAP for the specified TEI/SAPI on the LAPD instance */ diff --git a/include/osmocom/abis/lapd_pcap.h b/include/osmocom/abis/lapd_pcap.h index 1c0d555..36ddd7f 100644 --- a/include/osmocom/abis/lapd_pcap.h +++ b/include/osmocom/abis/lapd_pcap.h @@ -1,10 +1,14 @@ #ifndef _LAPD_PCAP_H_ #define _LAPD_PCAP_H_ +#include <sys/types.h> +#include <osmocom/core/msgb.h> + #define OSMO_LAPD_PCAP_INPUT 0 #define OSMO_LAPD_PCAP_OUTPUT 1 int osmo_pcap_lapd_open(char *filename, mode_t mode); +int osmo_pcap_lapd_set_fd(int fd); int osmo_pcap_lapd_write(int fd, int direction, struct msgb *msg); int osmo_pcap_lapd_close(int fd); diff --git a/include/osmocom/abis/unixsocket_proto.h b/include/osmocom/abis/unixsocket_proto.h new file mode 100644 index 0000000..25718ff --- /dev/null +++ b/include/osmocom/abis/unixsocket_proto.h @@ -0,0 +1,31 @@ + +#ifndef UNIXSOCKET_PROTO_H +#define UNIXSOCKET_PROTO_H + +/* The unix socket protocol is using a 2 byte header + * containg the version and type. + * + * header: | 1b version | 1b type | + * + * for data packets it would be + * + * data: | 0x1 | 0x0 | lapd ..| + * control: | 0x1 | 0x1 | control payload | + * + * Atm there is only one control packet: + * - set_altc (superchannel or timeslot) + * + * set_altc payload: + * | 4b magic | 1b new_state| + * | 0x23004200 | 0x0 | to timeslot + * | 0x23004200 | 0x1 | to superchannel + */ + +#define UNIXSOCKET_PROTO_VERSION 0x1 + +enum { + UNIXSOCKET_PROTO_DATA = 0x0, + UNIXSOCKET_PROTO_CONTROL = 0x1, +}; + +#endif /* UNIXSOCKET_PROTO_H */ |