libosmoisdn 1.9.0.209-e0c63
Osmocom ISDN library
v110_ta.h
Go to the documentation of this file.
1#pragma once
2
3#include <stdint.h>
4#include <stdbool.h>
5
7#include <osmocom/core/bits.h>
8#include <osmocom/isdn/v110.h>
9
10/* Definition of this struct is [intentionally] kept private */
11struct osmo_v110_ta;
12
19};
20
24 unsigned int flags;
27
29 struct {
35
37 void *priv;
38
43 void (*rx_cb)(void *priv, const ubit_t *buf, size_t buf_size);
44
49 void (*tx_cb)(void *priv, ubit_t *buf, size_t buf_size);
50
54 void (*status_update_cb)(void *priv, unsigned int status);
55};
56
57struct osmo_v110_ta *osmo_v110_ta_alloc(void *ctx, const char *name,
58 const struct osmo_v110_ta_cfg *cfg);
59void osmo_v110_ta_free(struct osmo_v110_ta *ta);
60
70};
71
73 enum osmo_v110_ta_timer timer,
74 unsigned long val_ms);
75
76int osmo_v110_ta_frame_in(struct osmo_v110_ta *ta, const struct osmo_v110_decoded_frame *in);
78
81
92};
93
94extern const struct value_string osmo_v110_ta_circuit_names[];
95extern const struct value_string osmo_v110_ta_circuit_descs[];
96
98static inline const char *osmo_v110_ta_circuit_name(enum osmo_v110_ta_circuit circuit)
99{
101}
102
104static inline const char *osmo_v110_ta_circuit_desc(enum osmo_v110_ta_circuit circuit)
105{
107}
108
109unsigned int osmo_v110_ta_get_status(const struct osmo_v110_ta *ta);
110bool osmo_v110_ta_get_circuit(const struct osmo_v110_ta *ta,
111 enum osmo_v110_ta_circuit circuit);
113 enum osmo_v110_ta_circuit circuit, bool active);
uint8_t ubit_t
const char * name
const char * get_value_string(const struct value_string *vs, uint32_t val)
a 'decoded' representation of a single V.110 frame.
Definition: v110.h:12
Configuration for a V.110 TA instance.
Definition: v110_ta.h:22
struct osmo_v110_ta_cfg::@4 flow_ctrl
Flow control configuration.
enum osmo_v100_sync_ra1_rate rate
Synchronous user rate.
Definition: v110_ta.h:26
void(* tx_cb)(void *priv, ubit_t *buf, size_t buf_size)
Transmit call-back of the application.
Definition: v110_ta.h:49
void * priv
Opaque application-private data; passed to call-backs.
Definition: v110_ta.h:37
void(* rx_cb)(void *priv, const ubit_t *buf, size_t buf_size)
Receive call-back of the application.
Definition: v110_ta.h:43
bool end_to_end
End-to-end (TA-to-TA) flow control state.
Definition: v110_ta.h:33
void(* status_update_cb)(void *priv, unsigned int status)
Modem status line update call-back (optional).
Definition: v110_ta.h:54
enum osmo_v110_local_flow_ctrl_mode local
Local TA-TE (DTE-DCE) flow control mode.
Definition: v110_ta.h:31
unsigned int flags
Configuration flags (behavior switches and quirks)
Definition: v110_ta.h:24
Definition: v110_ta.c:144
struct osmo_v110_ta_cfg * cfg
Definition: v110_ta.c:148
osmo_v100_sync_ra1_rate
enum for each supported V.110 synchronous RA1 function (one for each user bitrate)
Definition: v110.h:26
const struct value_string osmo_v110_ta_circuit_descs[]
Definition: v110_ta.c:68
const struct value_string osmo_v110_ta_circuit_names[]
Definition: v110_ta.c:58
bool osmo_v110_ta_get_circuit(const struct osmo_v110_ta *ta, enum osmo_v110_ta_circuit circuit)
Get state of a V.24 circuit of the given TA instance.
Definition: v110_ta.c:846
osmo_v110_ta_timer
Various timers for a V.110 TA instance.
Definition: v110_ta.h:62
@ OSMO_V110_TA_TIMER_T1
7.1.2 Connect TA to line: sync establishment timer
Definition: v110_ta.h:67
@ OSMO_V110_TA_TIMER_T2
7.1.4 Disconnect mode: disconnect confirmation timer
Definition: v110_ta.h:69
@ OSMO_V110_TA_TIMER_X1
7.1.5 Loss of frame synchronization: sync recovery timer.
Definition: v110_ta.h:65
static const char * osmo_v110_ta_circuit_desc(enum osmo_v110_ta_circuit circuit)
Get a brief description of the given TA's circuit.
Definition: v110_ta.h:104
static const char * osmo_v110_ta_circuit_name(enum osmo_v110_ta_circuit circuit)
Get a short name of the given TA's circuit (format: NNN[/ABBR]).
Definition: v110_ta.h:98
int osmo_v110_ta_set_timer_val_ms(struct osmo_v110_ta *ta, enum osmo_v110_ta_timer timer, unsigned long val_ms)
Configure a timer of the given V.110 TA instance.
Definition: v110_ta.c:740
void osmo_v110_ta_free(struct osmo_v110_ta *ta)
Release memory taken by the given V.110 TA instance.
Definition: v110_ta.c:726
osmo_v110_ta_circuit
ITU-T Table 9 "Interchange circuit" (see also ITU-T V.24 Chapter 3).
Definition: v110_ta.h:85
@ OSMO_V110_TA_C_107
DTE<-DCE | DSR (Data Set Ready)
Definition: v110_ta.h:88
@ OSMO_V110_TA_C_109
DTE<-DCE | DCD (Data Carrier Detect)
Definition: v110_ta.h:90
@ OSMO_V110_TA_C_106
DTE<-DCE | CTS (Clear to Send)
Definition: v110_ta.h:87
@ OSMO_V110_TA_C_108
DTE->DCE | DTR (Data Terminal Ready)
Definition: v110_ta.h:89
@ OSMO_V110_TA_C_105
DTE->DCE | RTS (Request to Send)
Definition: v110_ta.h:86
@ OSMO_V110_TA_C_133
DTE->DCE | Ready for receiving.
Definition: v110_ta.h:91
osmo_v110_local_flow_ctrl_mode
V.110 5.4.1 Local flow control (DTE-DCE or TE-TA) mode.
Definition: v110_ta.h:14
@ OSMO_V110_LOCAL_FLOW_CTRL_NONE
No local flow control.
Definition: v110_ta.h:15
@ OSMO_V110_LOCAL_FLOW_CTRL_133_106
5.4.1.1 133/106 operation
Definition: v110_ta.h:16
@ OSMO_V110_LOCAL_FLOW_CTRL_XON_XOFF
5.4.1.3 XON/XOFF operation
Definition: v110_ta.h:18
@ OSMO_V110_LOCAL_FLOW_CTRL_105_106
5.4.1.2 105/106 operation
Definition: v110_ta.h:17
unsigned int osmo_v110_ta_get_status(const struct osmo_v110_ta *ta)
Get the V.24 status bit-mask of the given TA instance.
Definition: v110_ta.c:821
int osmo_v110_ta_frame_in(struct osmo_v110_ta *ta, const struct osmo_v110_decoded_frame *in)
Feed a [decoded] V.110 frame into the given TA instance.
Definition: v110_ta.c:765
int osmo_v110_ta_frame_out(struct osmo_v110_ta *ta, struct osmo_v110_decoded_frame *out)
Pull a [decoded] V.110 frame out of the given TA instance.
Definition: v110_ta.c:789
struct osmo_v110_ta * osmo_v110_ta_alloc(void *ctx, const char *name, const struct osmo_v110_ta_cfg *cfg)
Allocate a V.110 TA (Terminal Adapter) instance.
Definition: v110_ta.c:679
int osmo_v110_ta_desync_ind(struct osmo_v110_ta *ta)
Indicate a synchronization loss event.
Definition: v110_ta.c:813
int osmo_v110_ta_set_circuit(struct osmo_v110_ta *ta, enum osmo_v110_ta_circuit circuit, bool active)
Activate/deactivate a V.24 circuit of the given TA instance.
Definition: v110_ta.c:857
int osmo_v110_ta_sync_ind(struct osmo_v110_ta *ta)
Indicate a synchronization establishment event.
Definition: v110_ta.c:801