Asterisk.org: Developer Documentation (28 Oct 2009)

Wed Oct 28 15:47:47 2009

## Asterisk developer's documentation

# adtranvofr.h

Go to the documentation of this file.

    00001 /*
    00002  * Asterisk -- A telephony toolkit for Linux.
    00003  *
    00004  * Implementation of Voice over Frame Relay, Adtran Style
    00005  *
    00006  * Copyright (C) 1999, Mark Spencer
    00007  *
    00008  * Mark Spencer <markster@linux-support.net>
    00009  *
    00010  * This program is free software, distributed under the terms of
    00011  * the GNU General Public License
    00012  */
    00013
    00014 #ifndef _ADTRANVOFR_H
    00015 #define _ADTRANVOFR_H
    00016
    00017 #define VOFR_CONTROL_ADTRAN      0x0
    00018 #define VOFR_CONTROL_VOICE       0x1
    00019 #define VOFR_CONTROL_RFC1490     0x3
    00020
    00021 #define VOFR_TYPE_SIGNAL      0x0
    00022 #define VOFR_TYPE_VOICE       0x1
    00023 #define VOFR_TYPE_ANSWER      0x2
    00024 #define VOFR_TYPE_FAX         0x3
    00025 #define VOFR_TYPE_DTMF        0x4
    00026
    00027 #define VOFR_CARD_TYPE_UNSPEC    0x0
    00028 #define VOFR_CARD_TYPE_FXS    0x1
    00029 #define VOFR_CARD_TYPE_FXO    0x2
    00030 #define VOFR_CARD_TYPE_ENM    0x3
    00031 #define VOFR_CARD_TYPE_VCOM      0x4
    00032 #define VOFR_CARD_TYPE_ASTERISK     0xf
    00033
    00034 #define VOFR_MODULATION_SINGLE      0x0
    00035 #define VOFR_MODULATION_V21      0x1
    00036 #define VOFR_MODULATION_V27ter_2 0x2
    00037 #define VOFR_MODULATION_V27ter_4 0x3
    00038 #define VOFR_MODULATION_V29_7    0x4
    00039 #define VOFR_MODULATION_V29_9    0x5
    00040 #define VOFR_MODULATION_V33_12      0x6
    00041 #define VOFR_MODULATION_V33_14      0x7
    00042
    00043 #define VOFR_ROUTE_NONE       0x0
    00044 #define VOFR_ROUTE_LOCAL      0x1
    00045 #define VOFR_ROUTE_VOICE      0x2
    00046 #define VOFR_ROUTE_DTE1       0x4
    00047 #define VOFR_ROUTE_DTE2       0x8
    00048 #define VOFR_ROUTE_DTE        0xC
    00049
    00050 #define VOFR_MASK_EI       0x80
    00051 #define VOFR_MASK_LI       0x40
    00052 #define VOFR_MASK_CONTROL     0x3F
    00053
    00054 #define VOFR_SIGNAL_ON_HOOK      0x00
    00055 #define VOFR_SIGNAL_OFF_HOOK     0x01
    00056 #define VOFR_SIGNAL_RING      0x40
    00057 #define VOFR_SIGNAL_SWITCHED_DIAL   0x08
    00058 #define VOFR_SIGNAL_BUSY      0x02
    00059 #define VOFR_SIGNAL_TRUNK_BUSY      0x04
    00060 #define VOFR_SIGNAL_UNKNOWN      0x10
    00061 #define VOFR_SIGNAL_OFFHOOK      0x81
    00062
    00063 #define VOFR_TRACE_SIGNAL     1 << 0
    00064 #define VOFR_TRACE_VOICE      1 << 1
    00065
    00066 #define VOFR_MAX_PKT_SIZE     1500
    00067
    00068 /*
    00069  * Wire level protocol
    00070  */
    00071
    00072 struct vofr_hdr {
    00073    u_int8_t control;    /* Also contains unused EI and LI bits */
    00074 #if __BYTE_ORDER == __LITTLE_ENDIAN
    00075    u_int8_t dtype:4;    /* Data type */
    00076    u_int8_t ctag:4;     /* Connect tag */
    00077    u_int8_t dlcih:4;    /* Hi 2 bits of DLCI x-ref */
    00078    u_int8_t vflags:4;      /* Voice Routing Flags */
    00079    u_int8_t dlcil;         /* Lo 8 bits of DLCI x-ref */
    00080    u_int8_t cid;        /* Channel ID */
    00081    u_int8_t mod:4;         /* Modulation */
    00082    u_int8_t remid:4;    /* Remote ID */
    00083 #elif __BYTE_ORDER == __BIG_ENDIAN
    00084    u_int8_t ctag:4;     /* Connect tag */
    00085    u_int8_t dtype:4;    /* Data type */
    00086    u_int8_t vflags:4;      /* Voice Routing Flags */
    00087    u_int8_t dlcih:4;    /* Hi 2 bits of DLCI x-ref */
    00088    u_int8_t dlcil;         /* Lo 8 bits of DLCI x-ref */
    00089    u_int8_t cid;        /* Channel ID */
    00090    u_int8_t remid:4;    /* Remote ID or Relay CMD*/
    00091    u_int8_t mod:4;         /* Modulation */
    00092 #else
    00093 #error   "Please fix <bytesex.h>"
    00094 #endif
    00095 #ifdef __GNUC__
    00096    u_int8_t data[0];    /* Data */
    00097 #endif
    00098 };
    00099
    00100 #define VOFR_HDR_SIZE 6
    00101
    00102 /* Number of milliseconds to fudge -- experimentally derived */
    00103 #define VOFR_FUDGE 2
    00104
    00105 #endif