35 #ifndef __WANPIPE_API_IFACE_H_
36 #define __WANPIPE_API_IFACE_H_
44 #if defined(__WINDOWS__)
77 #define WP_API_FEATURE_DTMF_EVENTS 1
78 #define WP_API_FEATURE_FE_ALARM 1
79 #define WP_API_FEATURE_EVENTS 1
80 #define WP_API_FEATURE_LINK_STATUS 1
81 #define WP_API_FEATURE_POL_REV 1
82 #define WP_API_FEATURE_LOGGER 1
83 #define WP_API_FEATURE_FAX_EVENTS 1
84 #define WP_API_FEATURE_RM_GAIN 1
85 #define WP_API_FEATURE_LOOP 1
86 #define WP_API_FEATURE_BUFFER_MULT 1
87 #define WP_API_FEATURE_RX_TX_ERRS 1
88 #define WP_API_FEATURE_EC_CHAN_STAT 1
89 #define WP_API_FEATURE_LIBSNG_HWEC 1
90 #define WP_API_FEATURE_DRIVER_GAIN 1
91 #define WP_API_FEATURE_FE_RW 1
92 #define WP_API_FEATURE_HWEC_PERSIST 1
93 #define WP_API_FEATURE_FAX_TYPE_EVENTS 1
94 #define WP_API_FEATURE_HARDWARE_RESCAN 1
95 #define WP_API_FEATURE_LED_CTRL 1
96 #define WP_API_FEATURE_SS7_FORCE_RX 1
97 #define WP_API_FEATURE_SS7_CFG_STATUS 1
98 #define WP_API_FEATURE_LIBSNG_HWEC_DTMF_REMOVAL 1
169 WANPIPEMON_READ_PERFORMANCE_STATS,
170 WANPIPEMON_FLUSH_PERFORMANCE_STATS,
191 typedef enum wp_bert_sequence_type{
192 WP_BERT_RANDOM_SEQUENCE = 1,
193 WP_BERT_ASCENDANT_SEQUENCE,
194 WP_BERT_DESCENDANT_SEQUENCE
195 }wp_bert_sequence_type_t;
197 #define WP_BERT_DECODE_SEQUENCE_TYPE(sequence) \
198 ((sequence) == WP_BERT_RANDOM_SEQUENCE) ? "WP_BERT_RANDOM_SEQUENCE" : \
199 ((sequence) == WP_BERT_ASCENDANT_SEQUENCE) ? "WP_BERT_ASCENDANT_SEQUENCE" : \
200 ((sequence) == WP_BERT_DESCENDANT_SEQUENCE) ? "WP_BERT_DESCENDANT_SEQUENCE" : \
201 "(Unknown BERT sequence)"
203 #define WP_BERT_STATUS_OUT_OF_SYNCH 0
204 #define WP_BERT_STATUS_IN_SYNCH 1
229 unsigned char ss7_hw_enable;
230 unsigned char ss7_hw_mode;
231 unsigned char ss7_hw_lssu_size;
232 unsigned char ss7_driver_repeat;
267 WP_API_CMD_READ_EVENT,
268 WP_API_CMD_SET_EVENT,
269 WP_API_CMD_SET_RX_GAINS,
270 WP_API_CMD_SET_TX_GAINS,
271 WP_API_CMD_CLEAR_RX_GAINS,
272 WP_API_CMD_CLEAR_TX_GAINS,
273 WP_API_CMD_GET_FE_ALARMS,
274 WP_API_CMD_ENABLE_HWEC,
275 WP_API_CMD_DISABLE_HWEC,
276 WP_API_CMD_SET_FE_STATUS,
277 WP_API_CMD_GET_FE_STATUS,
279 WP_API_CMD_DRV_MGMNT,
289 WP_API_CMD_EVENT_CTRL,
305 WP_API_CMD_GEN_FIFO_ERR_TX=500,
306 WP_API_CMD_GEN_FIFO_ERR_RX,
307 WP_API_CMD_START_CHAN_SEQ_DEBUG,
308 WP_API_CMD_STOP_CHAN_SEQ_DEBUG
317 WP_CDEV_CMD_SET_DPC_TIMEDIFF_MONITORING_OPTION=1,
318 WP_CDEV_CMD_SET_TX_INTERRUPT_TIMEDIFF_MONITORING_OPTION,
319 WP_CDEV_CMD_SET_RX_INTERRUPT_TIMEDIFF_MONITORING_OPTION,
320 WP_CDEV_CMD_PRINT_INTERRUPT_TIMEDIFF_MONITORING_INFO,
321 WP_CDEV_CMD_GET_INTERFACE_NAME
342 WP_API_EVENT_RM_DTMF,
345 WP_API_EVENT_RING_DETECT,
346 WP_API_EVENT_RING_TRIP_DETECT,
348 WP_API_EVENT_TXSIG_KEWL,
349 WP_API_EVENT_TXSIG_START,
350 WP_API_EVENT_TXSIG_OFFHOOK,
351 WP_API_EVENT_TXSIG_ONHOOK,
352 WP_API_EVENT_ONHOOKTRANSFER,
353 WP_API_EVENT_SETPOLARITY,
354 WP_API_EVENT_BRI_CHAN_LOOPBACK,
355 WP_API_EVENT_LINK_STATUS,
356 WP_API_EVENT_MODEM_STATUS,
357 WP_API_EVENT_POLARITY_REVERSE,
380 #define WP_API_EVENT_SET 0x01
381 #define WP_API_EVENT_GET 0x02
382 #define WP_API_EVENT_ENABLE 0x01
383 #define WP_API_EVENT_DISABLE 0x02
385 #define WP_API_EVENT_MODE_DECODE(mode) \
386 ((mode) == WP_API_EVENT_ENABLE) ? "Enable" : \
387 ((mode) == WP_API_EVENT_DISABLE) ? "Disable" : \
401 #define WPTDM_A_BIT WAN_RBS_SIG_A
402 #define WPTDM_B_BIT WAN_RBS_SIG_B
403 #define WPTDM_C_BIT WAN_RBS_SIG_C
404 #define WPTDM_D_BIT WAN_RBS_SIG_D
417 #define WP_API_EVENT_RXHOOK_OFF 0x01
418 #define WP_API_EVENT_RXHOOK_ON 0x02
419 #define WP_API_EVENT_RXHOOK_FLASH 0x03
420 #define WP_API_EVENT_RXHOOK_DECODE(state) \
421 ((state) == WP_API_EVENT_RXHOOK_OFF) ? "Off-hook" : \
422 ((state) == WP_API_EVENT_RXHOOK_FLASH) ? "Flash" : \
423 ((state) == WP_API_EVENT_RXHOOK_ON) ? "On-hook" : \
433 #define WP_API_EVENT_RING_PRESENT 0x01
434 #define WP_API_EVENT_RING_STOP 0x02
435 #define WP_API_EVENT_RING_DECODE(state) \
436 ((state) == WP_API_EVENT_RING_PRESENT) ? "Ring Present" : \
437 ((state) == WP_API_EVENT_RING_STOP) ? "Ring Stop" : \
448 #define WP_API_EVENT_RING_TRIP_PRESENT 0x01
449 #define WP_API_EVENT_RING_TRIP_STOP 0x02
450 #define WP_API_EVENT_RING_TRIP_DECODE(state) \
451 ((state) == WP_API_EVENT_RING_TRIP_PRESENT) ? "Ring Present" : \
452 ((state) == WP_API_EVENT_RING_TRIP_STOP) ? "Ring Stop" : \
463 #define WP_API_EVENT_LINK_STATUS_CONNECTED 0x01
464 #define WP_API_EVENT_LINK_STATUS_DISCONNECTED 0x02
465 #define WP_API_EVENT_LINK_STATUS_DECODE(status) \
466 ((status) == WP_API_EVENT_LINK_STATUS_CONNECTED) ? "Connected" : \
467 ((status) == WP_API_EVENT_LINK_STATUS_DISCONNECTED) ? "Disconnected" : \
479 #define WP_API_EVENT_POL_REV_POS_TO_NEG 0x01
480 #define WP_API_EVENT_POL_REV_NEG_TO_POS 0x02
481 #define WP_API_EVENT__POL_REV_NEG_TO_POS WP_API_EVENT_POL_REV_NEG_TO_POS
482 #define WP_API_EVENT_POLARITY_REVERSE_DECODE(polarity_reverse) \
483 ((polarity_reverse) == WP_API_EVENT_POL_REV_POS_TO_NEG) ? "+ve to -ve" : \
484 ((polarity_reverse) == WP_API_EVENT_POL_REV_NEG_TO_POS) ? "-ve to +ve" : \
502 #define WP_API_EVENT_TONE_DIAL 0x01
503 #define WP_API_EVENT_TONE_BUSY 0x02
504 #define WP_API_EVENT_TONE_RING 0x03
505 #define WP_API_EVENT_TONE_CONGESTION 0x04
506 #define WP_API_EVENT_TONE_DTMF 0x05
507 #define WP_API_EVENT_TONE_FAXCALLING 0x06
508 #define WP_API_EVENT_TONE_FAXCALLED 0x07
519 #define WAN_BRI_BCHAN1 0x01
520 #define WAN_BRI_BCHAN2 0x02
521 #define WAN_BRI_DCHAN 0x03
531 #define WP_PORT_NAME_FORM "wanpipe%d"
532 #define WP_INTERFACE_NAME_FORM "wanpipe%d_if%d"
533 #define WP_CTRL_DEV_NAME "wanpipe_ctrl"
534 #define WP_CONFIG_DEV_NAME "wanpipe"
535 #define WP_TIMER_DEV_NAME_FORM "wanpipe_timer%d"
536 #define WP_LOGGER_DEV_NAME "wanpipe_logger"
549 unsigned int rx_packets;
550 unsigned int tx_packets;
551 unsigned int rx_bytes;
552 unsigned int tx_bytes;
554 unsigned int rx_errors;
555 unsigned int tx_errors;
557 unsigned int rx_dropped;
559 unsigned int tx_dropped;
561 unsigned int multicast;
562 unsigned int collisions;
565 unsigned int rx_length_errors;
567 unsigned int rx_over_errors;
568 unsigned int rx_crc_errors;
570 unsigned int rx_frame_errors;
571 unsigned int rx_fifo_errors;
573 unsigned int rx_missed_errors;
576 unsigned int tx_aborted_errors;
577 unsigned int tx_carrier_errors;
579 unsigned int tx_fifo_errors;
581 unsigned int tx_heartbeat_errors;
582 unsigned int tx_window_errors;
584 unsigned int tx_idle_packets;
591 unsigned int current_number_of_frames_in_tx_queue;
592 unsigned int max_tx_queue_length;
595 unsigned int current_number_of_frames_in_rx_queue;
596 unsigned int max_rx_queue_length;
599 unsigned int max_event_queue_length;
600 unsigned int current_number_of_events_in_event_queue;
602 unsigned int rx_events;
603 unsigned int rx_events_dropped;
605 unsigned int rx_events_tone;
608 unsigned int rx_hdlc_abort_counter;
614 #define WP_AFT_CHAN_ERROR_STATS(chan_stats,var) chan_stats.var++;chan_stats.errors++
616 #define WP_AFT_RX_ERROR_SUM(chan_stats) chan_stats.rx_errors+ \
617 chan_stats.rx_dropped+ \
618 chan_stats.rx_length_errors + \
619 chan_stats.rx_crc_errors + \
620 chan_stats.rx_frame_errors + \
621 chan_stats.rx_fifo_errors + \
622 chan_stats.rx_missed_errors + \
623 chan_stats.rx_hdlc_abort_counter
625 #define WP_AFT_TX_ERROR_SUM(chan_stats) chan_stats.tx_errors+ \
626 chan_stats.tx_dropped + \
627 chan_stats.tx_aborted_errors + \
628 chan_stats.tx_carrier_errors + \
629 chan_stats.tx_fifo_errors+ \
630 chan_stats.tx_heartbeat_errors + \
631 chan_stats.tx_window_errors
640 #define WANPIPE_API_CMD_SZ 512
641 #define WANPIPE_API_DEV_CFG_MAX_SZ 337
644 #define WANPIPE_API_CMD_SZ_UNION WANPIPE_API_CMD_SZ - (sizeof(unsigned int)*3) - (sizeof(unsigned char)*2)
651 #define WANPIPE_API_CMD_RESERVED_SZ 128 - sizeof(int)*1 - sizeof(char)*3
657 #define WANPIPE_API_DEV_CFG_SZ sizeof(int)*20 + sizeof(char)*4 + WANPIPE_API_CMD_RESERVED_SZ + sizeof(wanpipe_chan_stats_t)
671 unsigned int hw_tdm_coding;
672 unsigned int hw_mtu_mru;
673 unsigned int usr_period;
674 unsigned int tdm_codec;
675 unsigned int power_level;
676 unsigned int rx_disable;
677 unsigned int tx_disable;
678 unsigned int usr_mtu_mru;
680 unsigned int rbs_poll;
681 unsigned int rbs_rx_bits;
682 unsigned int rbs_tx_bits;
684 unsigned int idle_flag;
685 unsigned int fe_alarms;
686 unsigned char fe_status;
687 unsigned int hw_dtmf;
688 unsigned int open_cnt;
689 unsigned int rx_queue_sz;
690 unsigned int tx_queue_sz;
692 unsigned int rxflashtime;
694 unsigned char hw_fax;
697 unsigned char reserved[WANPIPE_API_CMD_RESERVED_SZ];
746 unsigned char hw_fax;
749 unsigned char reserved[WANPIPE_API_CMD_RESERVED_SZ];
757 unsigned char data[WANPIPE_API_CMD_SZ_UNION];
758 unsigned int data_len;
764 #define WANPIPE_API_CMD_INIT_SPAN(wp_cmd_ptr, span_no) ((wp_cmd_ptr)->span = (unsigned char)span_no)
767 #define WANPIPE_API_CMD_INIT_CHAN(wp_cmd_ptr, chan_no) ((wp_cmd_ptr)->chan = (unsigned char)chan_no)
777 int (*wp_rbs_event)(
sng_fd_t fd,
unsigned char rbs_bits);
778 int (*wp_dtmf_event)(
sng_fd_t fd,
unsigned char dtmf,
unsigned char type,
unsigned char port);
779 int (*wp_rxhook_event)(
sng_fd_t fd,
unsigned char hook_state);
780 int (*wp_ring_detect_event)(
sng_fd_t fd,
unsigned char ring_state);
781 int (*wp_ring_trip_detect_event)(
sng_fd_t fd,
unsigned char ring_state);
782 int (*wp_fe_alarm_event)(
sng_fd_t fd,
unsigned int fe_alarm_event);
783 int (*wp_link_status_event)(
sng_fd_t fd,
unsigned int link_status_event);
803 #define WANPIPE_API_INIT_SPAN(wanpipe_api_ptr, span_no) WANPIPE_API_CMD_INIT_SPAN(&wanpipe_api_ptr->wp_cmd, span_no)
806 #define WANPIPE_API_INIT_CHAN(wanpipe_api_ptr, chan_no) WANPIPE_API_CMD_INIT_CHAN(&wanpipe_api_ptr->wp_cmd, chan_no)
wanpipe_api_events
Events available on wanpipe api device.
wanpipe_api_cmds
Commands used with WANPIPE_IOCTL_API_CMD IOCTL.
WANPIPE(tm) Driver API Headers and Defines.
Wanpipe API Device Command Structure used with WANPIPE_IOCTL_API_CMD.
TDM API Device Configuration Structure.
unsigned int hw_tdm_coding
BERT status and statistics.
int sng_fd_t
Windows/Unix file handle abstraction.
Wanpipe API Callback Structure.
int HANDLE
file handle type int, Ported from Windows
TDM API channel statistics.
wanpipe_api_callbacks_t wp_callback
Wanpipe API Event Structure.
Fixed-length List of Memory Descriptors.
WANPIPE_IOCTL_CODE
Wanpipe IOCTL Commands.
Wanpipe API Command Structure.
WANPIPE_IOCTL_PIPEMON_CMDS
Commands used with WANPIPE_IOCTL_PIPEMON IOCTL.
unsigned int synchonized_count
wanpipe_chan_stats_t stats
wanpipe_cdev_ctrl_cmds
Commands used with WANPIPE_IOCTL_CDEV_CTRL IOCTL.