libisdn
|
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <limits.h>
#include "Q931.h"
#include "Q931priv.h"
#include "Q932.h"
#include "utils/strstream.h"
Go to the source code of this file.
Data Structures | |
struct | Q931MesgErrorName |
Defines | |
#define | TMP_BUFSIZE 4096 |
#define | TMP_PUTS(fmt) |
#define | TMP_APPEND(fmt, args...) offset += snprintf(tmp + offset, sizeof(tmp) - offset, fmt, ##args); |
#define | TMP_MIN(x, y) ((x) < (y)) ? (x) : (y) |
Functions | |
L3INT | Q931MesgHeader (Q931_TrunkInfo_t *trunk, Q931mes_Generic *mes, L3UCHAR *OBuf, L3INT Size, L3INT *IOff) |
Create Q.931 Message header. | |
L3INT | Q931Umes_Generic (Q931_TrunkInfo_t *trunk, L3UCHAR *IBuf, Q931mes_Generic *mes, L3INT IOff, L3INT Size, struct Q931MesgErrors *Errs) |
A generic table driven codeset aware decode function for messages. | |
L3INT | Q931Dmes_Generic (Q931_TrunkInfo_t *trunk, Q931mes_Generic *msg, q931_msg_direction_t direction) |
Print message debug information. | |
L3INT | Q931Pmes_Generic (Q931_TrunkInfo_t *trunk, Q931mes_Generic *msg, L3INT ISize, L3UCHAR *OBuf, L3INT *OSize) |
L3INT | Q931MesgErrorsInit (struct Q931MesgErrors *merrs, const char id) |
L3INT | Q931MesgErrorsAddIE (struct Q931MesgErrors *merrs, const char id, const char size, const int offset, const int error) |
L3INT | Q931MesgErrorsCount (struct Q931MesgErrors *merrs) |
L3INT | Q931MesgErrorsPrint (Q931_TrunkInfo_t *trunk, const struct Q931MesgErrors *merrs, const unsigned char *IBuf, const int Size) |
Variables | |
struct Q931MessageIE | Q931MessageIEs [] |
#define TMP_APPEND | ( | fmt, | |
args... | |||
) | offset += snprintf(tmp + offset, sizeof(tmp) - offset, fmt, ##args); |
Definition at line 1275 of file Q931mes.c.
Referenced by Q931MesgErrorsPrint().
#define TMP_BUFSIZE 4096 |
Definition at line 1271 of file Q931mes.c.
Referenced by Q931MesgErrorsPrint().
#define TMP_MIN | ( | x, | |
y | |||
) | ((x) < (y)) ? (x) : (y) |
Definition at line 1310 of file Q931mes.c.
Referenced by Q931MesgErrorsPrint().
#define TMP_PUTS | ( | fmt | ) |
strncat(tmp + offset, fmt, sizeof(tmp) - offset - 1); \
offset += strlen(tmp + offset);
Definition at line 1272 of file Q931mes.c.
Referenced by Q931MesgErrorsPrint().
L3INT Q931Dmes_Generic | ( | Q931_TrunkInfo_t * | trunk, |
Q931mes_Generic * | msg, | ||
q931_msg_direction_t | direction | ||
) |
Print message debug information.
Q931Dmes_Generic
[in] | trunk | Q.931 trunk |
[in] | mes | Decoded message |
[in] | direction | Incoming/Outgoing direction |
Definition at line 918 of file Q931mes.c.
References strstream::buf, Q931mes_Generic::buf, Q931mes_Generic::CRV, Q931mes_Generic::CRVFlag, Q931_TrunkInfo::Dialect, Q931ie_Generic::IEId, L3INT, Q931_TrunkInfo::loglevel, Q931mes_Generic::MesType, name, Q931mes_Generic::ProtDisc, Q931_LOG_DEBUG, Q931_MSG_INCOMING, Q931Die(), Q931Die_Generic(), Q931DieIsNull(), Q931E_NO_ERROR, Q931LogRaw(), Q931ie_Generic::Size, strstream_get(), strstream_init_static(), strstream_printf(), strstream_puts(), STRSTREAM_SIZE, and Q931mes_Generic::Tei.
Referenced by Q931Pmes_Generic(), and Q931Umes_Generic().
L3INT Q931MesgErrorsAddIE | ( | struct Q931MesgErrors * | merrs, |
const char | id, | ||
const char | size, | ||
const int | offset, | ||
const int | error | ||
) |
Add IE error to message error buffer
merrs | Message error buffer |
id | IE id |
size | IE size |
offset | IE offset |
error | IE error code |
Definition at line 1240 of file Q931mes.c.
References Q931MesgErrors::error, id, Q931MesgErrors::id, Q931MesgErrors::ie_errors, Q931MesgErrors::nr_errors, Q931MesgErrors::nr_overflow, Q931MesgErrors::offset, Q931_MSGE_ERR_MAX, Q931E_NO_ERROR, and Q931MesgErrors::size.
Referenced by Q931Umes_Generic().
L3INT Q931MesgErrorsCount | ( | struct Q931MesgErrors * | merrs | ) |
Get number of errors
merrs | Message error buffer |
Definition at line 1265 of file Q931mes.c.
References Q931MesgErrors::nr_errors.
L3INT Q931MesgErrorsInit | ( | struct Q931MesgErrors * | merrs, |
const char | id | ||
) |
Initialize message error buffer and set message id
merrs | Message error buffer |
id | Message id |
Definition at line 1220 of file Q931mes.c.
References id, Q931MesgErrors::id, and Q931E_NO_ERROR.
Referenced by Q931Rx23().
L3INT Q931MesgErrorsPrint | ( | Q931_TrunkInfo_t * | trunk, |
const struct Q931MesgErrors * | merrs, | ||
const unsigned char * | IBuf, | ||
const int | Size | ||
) |
Print a detailed message error report
trunk | Q.931 Trunk |
merrs | Message error report |
IBuf | Message input buffer |
Size | Message size |
Definition at line 1321 of file Q931mes.c.
References Q931_TrunkInfo::Dialect, Q931MesgErrors::error, Q931MesgErrors::id, Q931MesgErrors::ie_errors, Q931_TrunkInfo::loglevel, Q931MessageIEEntry::maxsize, Q931MessageIEEntry::minsize, Q931MesgErrors::nr_errors, Q931MesgErrors::nr_overflow, Q931MesgErrors::offset, Q931_LOG_DEBUG, Q931_LOG_ERROR, Q931_MSGE_INVALID_CODESET, Q931_MSGE_INVALID_SIZE, Q931E_NO_ERROR, Q931Log(), Q931MesgErrors::size, TMP_APPEND, TMP_BUFSIZE, TMP_MIN, and TMP_PUTS.
Referenced by Q931Rx23().
L3INT Q931MesgHeader | ( | Q931_TrunkInfo_t * | trunk, |
Q931mes_Generic * | mes, | ||
L3UCHAR * | OBuf, | ||
L3INT | Size, | ||
L3INT * | IOff | ||
) |
Create Q.931 Message header.
Q931MesgHeader
Definition at line 699 of file Q931mes.c.
References Q931mes_Generic::CRV, Q931mes_Generic::CRVFlag, L3INT, L3UCHAR, Q931mes_Generic::MesType, Q931mes_Generic::ProtDisc, Q931_IS_BRI, Q931_LOG_DEBUG, and Q931Log().
Referenced by Q931Pmes_Generic().
L3INT Q931Pmes_Generic | ( | Q931_TrunkInfo_t * | trunk, |
Q931mes_Generic * | msg, | ||
L3INT | ISize, | ||
L3UCHAR * | OBuf, | ||
L3INT * | OSize | ||
) |
Definition at line 1064 of file Q931mes.c.
References Q931_TrunkInfo::Dialect, Q931Dialect::flags, Q931MessageIEEntry::id, L3INT, L3UCHAR, Q931mes_Generic::MesType, Q931_TrunkInfo::NetUser, Q931mes_Generic::ProtDisc, Q931_DIALECT_LOCKING_SHIFT_ONLY, Q931_LOG_DEBUG, Q931_LOG_ERROR, Q931_MSG_OUTGOING, Q931Dmes_Generic(), Q931E_ILLEGAL_IE, Q931E_MANDATORY_IE_MISSING, Q931E_NO_ERROR, Q931E_UNKNOWN_IE, Q931E_UNKNOWN_MESSAGE, Q931ie_SHIFT, Q931Log(), Q931MAXIE, Q931MesgHeader(), Q931Pie(), and Q931PieIsNull().
Referenced by ATT5ESSCreateTE(), Q931CreateNT(), and Q931CreateTE().
L3INT Q931Umes_Generic | ( | Q931_TrunkInfo_t * | trunk, |
L3UCHAR * | IBuf, | ||
Q931mes_Generic * | mes, | ||
L3INT | IOff, | ||
L3INT | Size, | ||
struct Q931MesgErrors * | Errs | ||
) |
A generic table driven codeset aware decode function for messages.
Q931Umes_Generic
[in] | trunk | Q.931 Trunk |
[in] | IBuf | Input buffer |
[out] | mes | Decoded Q.931 message |
[in] | IOff | Offset of input buffer |
[in] | Size | Number of bytes in input buffer |
[out] | Errs | Message parser errors |
Definition at line 739 of file Q931mes.c.
References Q931mes_Generic::buf, Q931MessageIEEntry::codeset, Q931_TrunkInfo::Dialect, Q931MessageIEEntry::flags, id, L3INT, L3UCHAR, Q931mes_Generic::MesType, Q931_TrunkInfo::NetUser, Q931mes_Generic::nr_ie, Q931mes_Generic::ProtDisc, Q931_LOG_DEBUG, Q931_LOG_ERROR, Q931_MSG_INCOMING, Q931_MSGE_INVALID_CODESET, Q931_MSGE_INVALID_DIRECTION, Q931_MSGE_INVALID_SIZE, Q931_MSGE_MANDATORY_MISSING, Q931_MSGE_NOT_ALLOWED, Q931_MSGE_OVERFLOW, Q931_MSGE_UNKNOWN, Q931_TFLAG_IGNORE_ILLEGAL_IE, Q931_TFLAG_IGNORE_UNKNOWN_IE, Q931Dmes_Generic(), Q931E_ILLEGAL_IE, Q931E_MANDATORY_IE_MISSING, Q931E_NO_ERROR, Q931E_UNEXPECTED_MESSAGE, Q931E_UNKNOWN_IE, Q931E_UNKNOWN_MESSAGE, Q931ie_REPEAT_INDICATOR, Q931ie_SHIFT, Q931Log(), Q931MAXIE, Q931MesgErrorsAddIE(), Q931TrunkIsSetFlag(), Q931Uie(), Q931UieIsNull(), and Q931mes_Generic::Size.
Referenced by ATT5ESSCreateTE(), Q931CreateNT(), and Q931CreateTE().
struct Q931MessageIE Q931MessageIEs[] |
Definition at line 64 of file Q931mes.c.
Referenced by Q931CreateNT(), and Q931CreateTE().