Loading...
Searching...
No Matches
v110_ta.h
Go to the documentation of this file.
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/bits.h>
#include <osmocom/isdn/v110.h>
/* Definition of this struct is [intentionally] kept private */
struct osmo_v110_ta;
enum osmo_v110_local_flow_ctrl_mode {
OSMO_V110_LOCAL_FLOW_CTRL_NONE,
OSMO_V110_LOCAL_FLOW_CTRL_133_106,
OSMO_V110_LOCAL_FLOW_CTRL_105_106,
OSMO_V110_LOCAL_FLOW_CTRL_XON_XOFF,
};
struct osmo_v110_ta_cfg {
unsigned int flags;
enum osmo_v100_sync_ra1_rate rate;
struct {
enum osmo_v110_local_flow_ctrl_mode local;
bool end_to_end;
} flow_ctrl;
void *priv;
void (*rx_cb)(void *priv, const ubit_t *buf, size_t buf_size);
void (*tx_cb)(void *priv, ubit_t *buf, size_t buf_size);
void (*status_update_cb)(void *priv, unsigned int status);
};
struct osmo_v110_ta *osmo_v110_ta_alloc(void *ctx, const char *name,
const struct osmo_v110_ta_cfg *cfg);
void osmo_v110_ta_free(struct osmo_v110_ta *ta);
enum osmo_v110_ta_timer {
OSMO_V110_TA_TIMER_X1 = -1,
OSMO_V110_TA_TIMER_T1 = 1,
OSMO_V110_TA_TIMER_T2 = 2,
};
int osmo_v110_ta_set_timer_val_ms(struct osmo_v110_ta *ta,
enum osmo_v110_ta_timer timer,
unsigned long val_ms);
int osmo_v110_ta_frame_in(struct osmo_v110_ta *ta, const struct osmo_v110_decoded_frame *in);
int osmo_v110_ta_frame_out(struct osmo_v110_ta *ta, struct osmo_v110_decoded_frame *out);
int osmo_v110_ta_sync_ind(struct osmo_v110_ta *ta);
int osmo_v110_ta_desync_ind(struct osmo_v110_ta *ta);
enum osmo_v110_ta_circuit {
OSMO_V110_TA_C_105,
OSMO_V110_TA_C_106,
OSMO_V110_TA_C_107,
OSMO_V110_TA_C_108,
OSMO_V110_TA_C_109,
OSMO_V110_TA_C_133,
};
extern const struct value_string osmo_v110_ta_circuit_names[];
extern const struct value_string osmo_v110_ta_circuit_descs[];
static inline const char *osmo_v110_ta_circuit_name(enum osmo_v110_ta_circuit circuit)
{
return get_value_string(osmo_v110_ta_circuit_names, circuit);
}
static inline const char *osmo_v110_ta_circuit_desc(enum osmo_v110_ta_circuit circuit)
{
return get_value_string(osmo_v110_ta_circuit_descs, circuit);
}
unsigned int osmo_v110_ta_get_status(const struct osmo_v110_ta *ta);
bool osmo_v110_ta_get_circuit(const struct osmo_v110_ta *ta,
enum osmo_v110_ta_circuit circuit);
int osmo_v110_ta_set_circuit(struct osmo_v110_ta *ta,
enum osmo_v110_ta_circuit circuit, bool active);
bits.h
ubit_t
uint8_t ubit_t
get_value_string
const char * get_value_string(const struct value_string *vs, uint32_t val)
osmo_v110_decoded_frame
a 'decoded' representation of a single V.110 frame.
Definition v110.h:12
osmo_v110_ta_cfg
Configuration for a V.110 TA instance.
Definition v110_ta.h:22
osmo_v110_ta_cfg::flow_ctrl
struct osmo_v110_ta_cfg::@4 flow_ctrl
Flow control configuration.
osmo_v110_ta_cfg::rate
enum osmo_v100_sync_ra1_rate rate
Synchronous user rate.
Definition v110_ta.h:26
osmo_v110_ta_cfg::tx_cb
void(* tx_cb)(void *priv, ubit_t *buf, size_t buf_size)
Transmit call-back of the application.
Definition v110_ta.h:49
osmo_v110_ta_cfg::priv
void * priv
Opaque application-private data; passed to call-backs.
Definition v110_ta.h:37
osmo_v110_ta_cfg::rx_cb
void(* rx_cb)(void *priv, const ubit_t *buf, size_t buf_size)
Receive call-back of the application.
Definition v110_ta.h:43
osmo_v110_ta_cfg::end_to_end
bool end_to_end
End-to-end (TA-to-TA) flow control state.
Definition v110_ta.h:33
osmo_v110_ta_cfg::status_update_cb
void(* status_update_cb)(void *priv, unsigned int status)
Modem status line update call-back (optional).
Definition v110_ta.h:54
osmo_v110_ta_cfg::local
enum osmo_v110_local_flow_ctrl_mode local
Local TA-TE (DTE-DCE) flow control mode.
Definition v110_ta.h:31
osmo_v110_ta_cfg::flags
unsigned int flags
Configuration flags (behavior switches and quirks)
Definition v110_ta.h:24
osmo_v110_ta
Definition v110_ta.c:144
osmo_v110_ta::cfg
struct osmo_v110_ta_cfg * cfg
Definition v110_ta.c:148
osmo_v110_ta::name
const char * name
Definition v110_ta.c:145
value_string
utils.h
v110.h
osmo_v100_sync_ra1_rate
osmo_v100_sync_ra1_rate
enum for each supported V.110 synchronous RA1 function (one for each user bitrate)
Definition v110.h:26
osmo_v110_ta_circuit_descs
const struct value_string osmo_v110_ta_circuit_descs[]
Definition v110_ta.c:68
osmo_v110_ta_circuit_names
const struct value_string osmo_v110_ta_circuit_names[]
Definition v110_ta.c:58
osmo_v110_ta_get_circuit
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
osmo_v110_ta_timer
Various timers for a V.110 TA instance.
Definition v110_ta.h:62
OSMO_V110_TA_TIMER_T1
@ 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
@ OSMO_V110_TA_TIMER_T2
7.1.4 Disconnect mode: disconnect confirmation timer
Definition v110_ta.h:69
OSMO_V110_TA_TIMER_X1
@ OSMO_V110_TA_TIMER_X1
7.1.5 Loss of frame synchronization: sync recovery timer.
Definition v110_ta.h:65
osmo_v110_ta_circuit_desc
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
osmo_v110_ta_circuit_name
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
osmo_v110_ta_set_timer_val_ms
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
osmo_v110_ta_free
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
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
@ OSMO_V110_TA_C_107
DTE<-DCE | DSR (Data Set Ready)
Definition v110_ta.h:88
OSMO_V110_TA_C_109
@ OSMO_V110_TA_C_109
DTE<-DCE | DCD (Data Carrier Detect)
Definition v110_ta.h:90
OSMO_V110_TA_C_106
@ OSMO_V110_TA_C_106
DTE<-DCE | CTS (Clear to Send)
Definition v110_ta.h:87
OSMO_V110_TA_C_108
@ OSMO_V110_TA_C_108
DTE->DCE | DTR (Data Terminal Ready)
Definition v110_ta.h:89
OSMO_V110_TA_C_105
@ OSMO_V110_TA_C_105
DTE->DCE | RTS (Request to Send)
Definition v110_ta.h:86
OSMO_V110_TA_C_133
@ OSMO_V110_TA_C_133
DTE->DCE | Ready for receiving.
Definition v110_ta.h:91
osmo_v110_local_flow_ctrl_mode
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
@ OSMO_V110_LOCAL_FLOW_CTRL_NONE
No local flow control.
Definition v110_ta.h:15
OSMO_V110_LOCAL_FLOW_CTRL_133_106
@ 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
@ 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
@ OSMO_V110_LOCAL_FLOW_CTRL_105_106
5.4.1.2 105/106 operation
Definition v110_ta.h:17
osmo_v110_ta_get_status
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
osmo_v110_ta_frame_in
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
osmo_v110_ta_frame_out
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
osmo_v110_ta_alloc
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
osmo_v110_ta_desync_ind
int osmo_v110_ta_desync_ind(struct osmo_v110_ta *ta)
Indicate a synchronization loss event.
Definition v110_ta.c:813
osmo_v110_ta_set_circuit
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
osmo_v110_ta_sync_ind
int osmo_v110_ta_sync_ind(struct osmo_v110_ta *ta)
Indicate a synchronization establishment event.
Definition v110_ta.c:801