* make sure we can obtain signalling type and timslot type names

* make sure every e1 timeslot has a valid backpointer to its line
This commit is contained in:
Harald Welte 2009-03-10 19:44:48 +00:00
parent 4d87f24e6f
commit d256d4f19c
2 changed files with 30 additions and 1 deletions

View File

@ -16,6 +16,7 @@ enum e1inp_sign_type {
E1INP_SIGN_OML,
E1INP_SIGN_RSL,
};
const char *e1inp_signtype_name(enum e1inp_sign_type tp);
struct e1inp_ts;
@ -50,6 +51,7 @@ enum e1inp_ts_type {
E1INP_TS_TYPE_SIGN,
E1INP_TS_TYPE_TRAU,
};
const char *e1inp_tstype_name(enum e1inp_ts_type tp);
/* A timeslot in the E1 interface */
struct e1inp_ts {

View File

@ -180,6 +180,31 @@ static void write_pcap_packet(int direction, struct sockaddr_mISDN* addr,
}
#endif
static const char *sign_types[] = {
[E1INP_SIGN_NONE] = "None",
[E1INP_SIGN_OML] = "OML",
[E1INP_SIGN_RSL] = "RSL",
};
const char *e1inp_signtype_name(enum e1inp_sign_type tp)
{
if (tp >= ARRAY_SIZE(sign_types))
return "undefined";
return sign_types[tp];
}
static const char *ts_types[] = {
[E1INP_TS_TYPE_NONE] = "None",
[E1INP_TS_TYPE_SIGN] = "Signalling",
[E1INP_TS_TYPE_TRAU] = "TRAU",
};
const char *e1inp_tstype_name(enum e1inp_ts_type tp)
{
if (tp >= ARRAY_SIZE(ts_types))
return "undefined";
return ts_types[tp];
}
/* callback when a TRAU frame was received */
static int subch_cb(struct subch_demux *dmx, int ch, u_int8_t *data, int len,
void *_priv)
@ -449,8 +474,10 @@ int e1inp_line_register(struct e1inp_line *line)
{
int i;
for (i = 0; i < NUM_E1_TS; i++)
for (i = 0; i < NUM_E1_TS; i++) {
line->ts[i].num = i+1;
line->ts[i].line = line;
}
llist_add_tail(&line->list, &e1inp_line_list);