libsangoma  1
Classes | Macros | Typedefs | Enumerations
wanpipe_api_hdr.h File Reference

WANPIPE(tm) Driver API Headers and Defines. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  wp_api_event
 Wanpipe API Event Structure. More...
 
struct  wp_api_hdr
 Wanpipe API Header Structure. More...
 
struct  wp_api_element
 Wanpipe API Element contains header and data. More...
 
struct  wan_iovec
 Memory Descriptor of a single buffer. This structure used internally by libsangoma. More...
 
struct  wan_iovec_list
 Fixed-length List of Memory Descriptors. More...
 
struct  wan_msghdr
 Variable-length List of Memory Descriptors. More...
 
struct  _API_POLL_STRUCT
 Windows poll structure used to implement blocking poll for read/write/event. More...
 

Macros

#define WAN_MAX_EVENT_SZ   64
 Size of wanpipe api header used in tx/rx. More...
 
#define WAN_MAX_EVENT_SZ_UNION   WAN_MAX_EVENT_SZ-(sizeof(u_int8_t)*4)-(sizeof(u_int32_t)*2)
 
#define wp_api_event_type   event_type
 
#define wp_api_event_mode   mode
 
#define wp_api_event_channel   channel
 
#define wp_api_event_span   span
 
#define wp_api_event_alarm   te1_alarm.alarm
 
#define wp_api_event_rbs_bits   te1_rbs.rbs_bits
 
#define wp_api_event_hook_state   rm_hook.state
 
#define wp_api_event_hook_sig   rm_hook.sig
 
#define wp_api_event_ring_state   rm_ring.state
 
#define wp_api_event_tone_type   rm_tone.type
 
#define wp_api_event_dtmf_digit   dtmf.digit
 
#define wp_api_event_dtmf_type   dtmf.type
 
#define wp_api_event_dtmf_port   dtmf.port
 
#define wp_api_event_ohttimer   rm_common.ohttimer
 
#define wp_api_event_polarity   rm_common.polarity
 
#define wp_api_event_polarity_reverse   rm_common.polarity_reverse
 
#define wp_api_event_link_status   linkstatus.status
 
#define wp_api_event_serial_status   serial.status
 
#define wp_api_event_time_stamp_sec   time_stamp_sec
 
#define wp_api_event_time_stamp_usec   time_stamp_usec
 
#define wp_api_event_gain_value   rm_gain.gain
 
#define WAN_MAX_HDR_SZ   64
 Size of wanpipe api header used in tx/rx. More...
 
#define WAN_MAX_HDR_SZ_UNION   WAN_MAX_HDR_SZ-sizeof(u_int8_t)-sizeof(u_int16_t)-(sizeof(u_int32_t)*2)
 
#define wp_api_hdr_operation_status   operation_status
 
#define wp_api_hdr_data_length   data_length
 
#define wp_api_hdr_time_stamp_sec   time_stamp_sec
 
#define wp_api_hdr_time_stamp_use   time_stamp_usec
 
#define wp_api_legacy_rbs_channel   aft_legacy_rbs.channel
 
#define wp_api_legacy_rbs_status   aft_legacy_rbs.status
 
#define wp_api_rx_hdr_crc   rx_h.crc
 
#define wp_api_rx_hdr_error_map   rx_h.crc
 
#define wp_api_rx_hdr_max_queue_length   rx_h.max_rx_queue_length
 
#define wp_api_rx_hdr_number_of_frames_in_queue   rx_h.current_number_of_frames_in_rx_queue
 
#define wp_api_rx_hdr_time_stamp_sec   time_stamp_sec
 
#define wp_api_rx_hdr_time_stamp_use   time_stamp_usec
 
#define wp_api_rx_hdr_errors   rx_h.errors
 
#define wp_api_tx_hdr_max_queue_length   tx_h.max_tx_queue_length
 
#define wp_api_tx_hdr_number_of_frames_in_queue   tx_h.current_number_of_frames_in_tx_queue
 
#define wp_api_tx_hdr_tx_idle_packets   tx_h.tx_idle_packets
 
#define wp_api_tx_hdr_time_stamp_sec   time_stamp_sec
 
#define wp_api_tx_hdr_time_stamp_use   time_stamp_usec
 
#define wp_api_tx_hdr_errors   tx_h.errors
 
#define wp_api_rx_hdr_error_flag   operation_status
 
#define wp_api_rx_hdr_station   operation_status
 
#define wp_api_rx_hdr_time_stamp   data_length
 
#define wp_api_tx_hdr_hdlc_rpt_len   rpt.len
 
#define wp_api_tx_hdr_hdlc_rpt_data   rpt.data
 
#define wp_api_tx_hdr_hdlc_rpt_repeat   rpt.repeat
 
#define wp_api_tx_hdr_aft_ss7_type   ss7_hw.type
 
#define wp_api_tx_hdr_aft_ss7_force_tx   ss7_hw.force_tx
 
#define wp_api_tx_hdr_aft_ss7_data   ss7_hw.data
 
#define wp_api_rx_hdr_xdlc_state   xdlc.state
 
#define wp_api_rx_hdr_xdlc_address   xdlc.address
 
#define wp_api_rx_hdr_xdlc_exception   xdlc.exception
 
#define wan_hdr_xdlc_state   xdlc.state
 
#define wan_hdr_xdlc_address   xdlc.address
 
#define wan_hdr_xdlc_exception   xdlc.exception
 
#define wp_api_rx_hdr_chdlc_error_flag   wp_api_rx_hdr_error_flag
 
#define wp_api_rx_hdr_chdlc_time_stamp   wp_api_rx_hdr_time_stamp
 
#define wp_api_rx_hdr_chdlc_time_sec   time_stamp_sec
 
#define wp_api_rx_hdr_chdlc_time_usec   time_stamp_usec
 
#define wan_hdr_chdlc_error_flag   wp_api_rx_hdr_chdlc_error_flag
 
#define wan_hdr_chdlc_time_stamp   wp_api_rx_hdr_chdlc_time_stamp
 
#define wan_hdr_chdlc_time_sec   wp_api_rx_hdr_chdlc_time_sec
 
#define wan_hdr_chdlc_time_usec   wp_api_rx_hdr_chdlc_time_usec
 
#define wp_api_rx_hdr_bitstrm_error_flag   wp_api_rx_hdr_error_flag
 
#define wp_api_rx_hdr_bitstrm_time_stamp   wp_api_rx_hdr_time_stamp
 
#define wp_api_rx_hdr_bitstrm_time_sec   time_stamp_sec
 
#define wp_api_rx_hdr_bitstrm_time_usec   time_stamp_usec
 
#define wp_api_rx_hdr_bitstrm_channel   bitstrm.channel
 
#define wp_api_rx_hdr_bitstrm_direction   bitstrm.direction
 
#define wan_hdr_bitstrm_error_flag   wp_api_rx_hdr_bitstrm_error_flag
 
#define wan_hdr_bitstrm_time_stamp   wp_api_rx_hdr_bitstrm_data_length
 
#define wan_hdr_bitstrm_time_sec   wp_api_rx_hdr_bitstrm_time_sec
 
#define wan_hdr_bitstrm_time_usec   wp_api_rx_hdr_bitstrm_time_usec
 
#define wan_hdr_bitstrm_channel   wp_api_rx_hdr_bitstrm_channel
 
#define wan_hdr_bitstrm_direction   wp_api_rx_hdr_bitstrm_direction
 
#define wp_api_rx_hdr_hdlc_error_flag   wp_api_rx_hdr_error_flag
 
#define wp_api_rx_hdr_hdlc_time_stamp   wp_api_rx_hdr_time_stamp
 
#define wp_api_rx_hdr_hdlc_time_sec   time_stamp_sec
 
#define wp_api_rx_hdr_hdlc_time_usec   time_stamp_usec
 
#define wan_hdr_hdlc_error_flag   wp_api_rx_hdr_error_flag
 
#define wan_hdr_hdlc_time_stamp   wp_api_rx_hdr_time_stamp
 
#define wp_api_rx_hdr_lapb_pf   lapb.pf
 
#define wp_api_rx_hdr_lapb_exception   lapb.exception
 
#define wp_api_rx_hdr_lapb_time_sec   time_stamp_sec
 
#define wp_api_rx_hdr_lapb_time_usec   time_stamp_usec
 
#define wan_hdr_lapb_pf   wp_api_rx_hdr_lapb_pf
 
#define wan_hdr_lapb_exception   wp_api_rx_hdr_lapb_exception
 
#define wp_api_rx_hdr_fr_attr   wp_api_rx_hdr_error_flag
 
#define wp_api_rx_hdr_fr_time_stamp   wp_api_rx_hdr_time_stamp
 
#define wp_api_rx_hdr_fr_time_sec   time_stamp_sec
 
#define wp_api_rx_hdr_fr_time_usec   time_stamp_usec
 
#define wan_hdr_fr_attr   wp_api_rx_hdr_fr_attr
 
#define wan_hdr_fr_time_stamp   wp_api_rx_hdr_fr_time_stamp
 
#define wan_hdr_fr_time_sec   wp_api_rx_hdr_fr_time_sec
 
#define wan_hdr_fr_time_usec   wp_api_rx_hdr_fr_time_usec
 
#define wp_api_rx_hdr_ss7_legacy_sio   wp_api_rx_hdr_error_flag
 
#define wp_api_rx_hdr_ss7_legacy_time_stamp   wp_api_rx_hdr_time_stamp
 
#define wp_api_rx_hdr_event_serial_status   serial.status
 
#define MAX_NO_DATA_BYTES_IN_FRAME   8188
 Maximum tx/rx data size. More...
 
#define wp_api_el_operation_status   hdr.wp_api_hdr_operation_status
 
#define wp_api_el_data_length   hdr.wp_api_hdr_data_length
 
#define wp_api_el_time_stamp_sec   hdr.wp_api_hdr_time_stamp_sec
 
#define wp_api_el_time_stamp_use   hdr.wp_api_hdr_time_stamp_use
 
#define wp_api_rx_el_crc   hdr.wp_api_rx_hdr_crc
 
#define wp_api_rx_el_max_queue_length   hdr.wp_api_rx_hdr_max_queue_length
 
#define wp_api_rx_el_number_of_frames_in_queue   hdr.wp_api_rx_hdr_number_of_frames_in_queue
 
#define wp_api_tx_el_max_queue_length   hdr.wp_api_tx_hdr_max_queue_length
 
#define wp_api_tx_el_number_of_frames_in_queue   hdr.wp_api_tx_hdr_number_of_frames_in_queue
 
#define WAN_IOVEC_LIST_LEN   5
 
#define SDLA_DECODE_SANG_STATUS(status)
 Print decode of Sangoma Return Codes.
 
#define SANG_SUCCESS(status)   (status == SANG_STATUS_SUCCESS)
 
#define SANG_ERROR(status)   (!SANG_SUCCESS(status))
 

Typedefs

typedef struct wp_api_event wp_api_event_t
 Wanpipe API Event Structure.
 
typedef struct wp_api_hdr wp_api_hdr_t
 Wanpipe API Header Structure.
 
typedef struct wp_api_element wp_api_element_t
 Wanpipe API Element contains header and data.
 
typedef struct wan_iovec wan_iovec_t
 Memory Descriptor of a single buffer. This structure used internally by libsangoma.
 
typedef struct wan_iovec_list wan_iovec_list_t
 Fixed-length List of Memory Descriptors.
 
typedef struct wan_msghdr wan_msghdr_t
 Variable-length List of Memory Descriptors.
 
typedef struct _API_POLL_STRUCT API_POLL_STRUCT
 Windows poll structure used to implement blocking poll for read/write/event.
 
typedef enum SANG_STATUS SANG_STATUS_T
 Wanpipe API Return codes.
 

Enumerations

enum  SANG_STATUS {
  SANG_STATUS_SUCCESS =0, SANG_STATUS_RX_DATA_TIMEOUT, SANG_STATUS_RX_DATA_AVAILABLE, SANG_STATUS_NO_DATA_AVAILABLE,
  SANG_STATUS_TX_TIMEOUT, SANG_STATUS_TX_DATA_TOO_LONG, SANG_STATUS_TX_DATA_TOO_SHORT, SANG_STATUS_TX_HDR_TOO_SHORT,
  SANG_STATUS_LINE_DISCONNECTED, SANG_STATUS_PROTOCOL_DISCONNECTED, SANG_STATUS_LINE_CONNECTED, SANG_STATUS_PROTOCOL_CONNECTED,
  SANG_STATUS_COMMAND_ALREADY_RUNNING, SANG_STATUS_BUFFER_TOO_SMALL, SANG_STATUS_FAILED_TO_LOCK_USER_MEMORY, SANG_STATUS_FAILED_ALLOCATE_MEMORY,
  SANG_STATUS_INVALID_DEVICE_REQUEST, SANG_STATUS_INVALID_PARAMETER, SANG_STATUS_GENERAL_ERROR, SANG_STATUS_DEVICE_BUSY,
  SANG_STATUS_INVALID_DEVICE, SANG_STATUS_IO_ERROR, SANG_STATUS_UNSUPPORTED_FUNCTION, SANG_STATUS_UNSUPPORTED_PROTOCOL,
  SANG_STATUS_DEVICE_ALREADY_EXIST, SANG_STATUS_DEV_INIT_INCOMPLETE, SANG_STATUS_TRACE_QUEUE_EMPTY, SANG_STATUS_OPTION_NOT_SUPPORTED,
  SANG_STATUS_API_EVENT_AVAILABLE, SANG_STATUS_CAN_NOT_STOP_DEVICE_WHEN_ALREADY_STOPPED, SANG_STATUS_CAN_NOT_RUN_TWO_PORT_CMDS_AT_THE_SAME_TIME, SANG_STATUS_ASSOCIATED_IRP_SYSTEM_BUFFER_NULL_ERROR,
  SANG_STATUS_STRUCTURE_SIZE_MISMATCH_ERROR, SANG_STATUS_REGISTRY_ERROR =180, SANG_STATUS_IO_PENDING, SANG_STATUS_APIPOLL_TIMEOUT,
  SANG_STATUS_NO_FREE_BUFFERS, SANG_STATUS_SHARED_EVENT_INIT_ERROR, SANG_STATUS_DATA_QUEUE_EMPTY =190, SANG_STATUS_DATA_QUEUE_FULL,
  SANG_STATUS_INVALID_IRQL
}
 Wanpipe API Return codes. More...
 

Detailed Description

WANPIPE(tm) Driver API Headers and Defines.

Authors: Nenad Corbic ncorb.nosp@m.ic@s.nosp@m.angom.nosp@m.a.co.nosp@m.m David Rokhvarg david.nosp@m.r@sa.nosp@m.ngoma.nosp@m..com Alex Fledman alex@.nosp@m.sang.nosp@m.oma.c.nosp@m.om

Copyright (c) 2007 - 08, Sangoma Technologies All rights reserved.

THIS SOFTWARE IS PROVIDED BY Sangoma Technologies ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Sangoma Technologies BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT

(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS

Definition in file wanpipe_api_hdr.h.

Macro Definition Documentation

#define WAN_MAX_EVENT_SZ   64

Size of wanpipe api header used in tx/rx.

The WAN_MAX_HDR_SZ is the size of wp_api_event_t structure It can be used to confirm compilation problems. if (sizeof(wp_api_event_t) != WAN_MAX_HDR_SZ) ...

Definition at line 49 of file wanpipe_api_hdr.h.

#define wp_api_event_type   event_type

These defines MUST be used to access wp_api_event_t structure. The wp_api_event_t should not be accessed directly, in order to keep backward compile compatibility.

Definition at line 112 of file wanpipe_api_hdr.h.

#define WAN_MAX_HDR_SZ   64

Size of wanpipe api header used in tx/rx.

Wanpipe Rx/Tx API Header Structure

This is a UNIFIED common API Header structure for all protocols and all APIs.

data_length Windows uses this varialbe for data length, Linux legacy uses this variable as time_stamp

The WAN_MAX_HDR_SZ is the size of wp_api_event_t structure It can be used to confirm compilation problems. if (sizeof(wp_api_event_t) != WAN_MAX_HDR_SZ) ...

Definition at line 155 of file wanpipe_api_hdr.h.

#define wp_api_hdr_operation_status   operation_status

These defines MUST be used to access wp_api_hdr_t structure. The wp_api_hdr_t should not be accessed directly, in order to keep backward compile compatibility.

Definition at line 234 of file wanpipe_api_hdr.h.

#define wp_api_rx_hdr_error_flag   operation_status

Defines below are Deprecated and are for backward compability

Definition at line 263 of file wanpipe_api_hdr.h.

#define MAX_NO_DATA_BYTES_IN_FRAME   8188

Maximum tx/rx data size.

Wanpipe API Element Structure

Definition at line 357 of file wanpipe_api_hdr.h.

Referenced by handle_data().

#define wp_api_el_operation_status   hdr.wp_api_hdr_operation_status

These defines MUST be used to access wp_api_element_t structure. The wp_api_element_t should not be accessed directly, in order to keep backward compile compatibility.

Definition at line 384 of file wanpipe_api_hdr.h.

Enumeration Type Documentation

Wanpipe API Return codes.

Extra care should be taken when changing SANG_STATUS_xxx definitions to keep compatibility with existing binary files!

Enumerator
SANG_STATUS_SUCCESS 

An operation completed successfully

SANG_STATUS_RX_DATA_TIMEOUT 

Return codes specific for data reception: No data was received. NOT an error.

SANG_STATUS_RX_DATA_AVAILABLE 

Data was received.

SANG_STATUS_NO_DATA_AVAILABLE 

There is no RX data in API receive queue

SANG_STATUS_TX_TIMEOUT 

Return codes specific for data transmission:Transmit command timed out

SANG_STATUS_TX_DATA_TOO_LONG 

Longer than MTU

SANG_STATUS_TX_DATA_TOO_SHORT 

Shorter than minimum

SANG_STATUS_TX_HDR_TOO_SHORT 

Tx Header is too short

SANG_STATUS_LINE_DISCONNECTED 

Return codes specific for line status:Physical line (T1/E1/Serial) is disconnected.

SANG_STATUS_PROTOCOL_DISCONNECTED 

The Communication Protocol (CHDLC/Frame Relay/PPP/LAPD...) is disconnected

SANG_STATUS_LINE_CONNECTED 

Physical line (T1/E1/Serial) is connected.

SANG_STATUS_PROTOCOL_CONNECTED 

The Communication Protocol (CHDLC/Frame Relay/PPP/LAPD...) is connected

SANG_STATUS_COMMAND_ALREADY_RUNNING 

Return codes specific for general errors:Two threads attempting to access device at the same time.

SANG_STATUS_BUFFER_TOO_SMALL 

Buffer passed to API is too small.

SANG_STATUS_FAILED_TO_LOCK_USER_MEMORY 

Kernel error

SANG_STATUS_FAILED_ALLOCATE_MEMORY 

Memory allocatin failure

SANG_STATUS_INVALID_DEVICE_REQUEST 

Command is invalid for device type.

SANG_STATUS_INVALID_PARAMETER 

Invalid parameter

SANG_STATUS_GENERAL_ERROR 

General interal error

SANG_STATUS_DEVICE_BUSY 

Device is busy

SANG_STATUS_INVALID_DEVICE 

Invalid device selected

SANG_STATUS_IO_ERROR 

IO error on device

SANG_STATUS_UNSUPPORTED_FUNCTION 

Unsupported command or function

SANG_STATUS_UNSUPPORTED_PROTOCOL 

Unsupported protocol selected

SANG_STATUS_DEVICE_ALREADY_EXIST 

Device already exists

SANG_STATUS_DEV_INIT_INCOMPLETE 

Device initialization failed or not done

SANG_STATUS_TRACE_QUEUE_EMPTY 

Trace queue empty

SANG_STATUS_OPTION_NOT_SUPPORTED 

Unsupported command or option

SANG_STATUS_API_EVENT_AVAILABLE 

Wanpipe API Event AvailableWanpipe API Event is available

SANG_STATUS_CAN_NOT_STOP_DEVICE_WHEN_ALREADY_STOPPED 

API Operation Internal errors Failed to stop device, already stopped

SANG_STATUS_CAN_NOT_RUN_TWO_PORT_CMDS_AT_THE_SAME_TIME 

Failed to execute command, busy due to collision

SANG_STATUS_STRUCTURE_SIZE_MISMATCH_ERROR 

Header size mistmatch between user & driver. Recompilation is necessary

SANG_STATUS_REGISTRY_ERROR 

Windows Specific definitionsWindows Registry Error

SANG_STATUS_IO_PENDING 

Asynchronous IO

SANG_STATUS_APIPOLL_TIMEOUT 

API Poll timeout - no events or data

SANG_STATUS_SHARED_EVENT_INIT_ERROR 

Driver can not use 'shared event' supplied by the API user

SANG_STATUS_DATA_QUEUE_EMPTY 

For internal API use only. Range reserved for internal API use startqueue empty

SANG_STATUS_DATA_QUEUE_FULL 

queue empty full

SANG_STATUS_INVALID_IRQL 

Driver routine was called at invalid IRQL.

Definition at line 487 of file wanpipe_api_hdr.h.

488 {
489 
492  /*************************************/
499  /*************************************/
507  /*************************************/
515  /*************************************/
536  /*************************************/
542  /*************************************/
547  SANG_STATUS_ASSOCIATED_IRP_SYSTEM_BUFFER_NULL_ERROR,
551  /*************************************/
557  SANG_STATUS_NO_FREE_BUFFERS,
560  /****************************************/
enum SANG_STATUS SANG_STATUS_T
Wanpipe API Return codes.