00001
00039 #ifndef _LIBSANGOMA_H
00040 #define _LIBSANGOMA_H
00041
00042 #ifdef __linux__
00043 #ifndef __LINUX__
00044
00045 #define __LINUX__
00046 #endif
00047 #endif
00048
00049 #ifdef __cplusplus
00050 extern "C" {
00051 #endif
00052
00053 #include <stdio.h>
00054
00055
00060 #define WANPIPE_TDM_API 1
00061
00062
00063
00068 #define LIBSANGOMA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
00069
00074 #define LIBSANGOMA_VERSION_CODE LIBSANGOMA_VERSION(3,3,0)
00075
00080 #define LIBSANGOMA_VERSION_STR "3.3.0"
00081
00082 struct sangoma_wait_obj;
00083 #define sangoma_wait_obj_t struct sangoma_wait_obj
00084
00085
00096 #define SANGOMA_DECLARE_TDM_API_CMD(_name_) wanpipe_api_t _name_
00097
00098 #define SANGOMA_INIT_TDM_API_CMD(_name_) memset(&_name_,0,sizeof(_name_)); \
00099 SANGOMA_INIT_TDM_API_CMD_RESULT(_name_)
00100
00101 #define SANGOMA_INIT_TDM_API_CMD_RESULT(_name_) (_name_).wp_cmd.result = SANG_STATUS_GENERAL_ERROR
00102
00103 #define SANGOMA_DECLARE_INIT_TDM_API_CMD(_name_) wanpipe_tdm_api_t _name_; SANGOMA_INIT_TDM_API_CMD(_name_);
00104
00105
00106 #if defined(WIN32) || defined(WIN64)
00107 #ifndef __WINDOWS__
00108 #define __WINDOWS__
00109 #endif
00110 #include <windows.h>
00111 #include <winioctl.h>
00112 #include <conio.h>
00113 #include <stddef.h>
00114 #include <stdlib.h>
00115 #include <time.h>
00116
00121 #ifdef __COMPILING_LIBSANGOMA__
00122 # define _LIBSNG_CALL __declspec(dllexport) __cdecl
00123 #else
00124 # ifdef __LIBSANGOMA_IS_STATIC_LIB__
00125
00126 # define _LIBSNG_CALL __cdecl
00127 # else
00128
00129 # define _LIBSNG_CALL __declspec(dllimport) __cdecl
00130 # endif
00131 #endif
00132
00137 #define SANGOMA_INFINITE_API_POLL_WAIT INFINITE
00138 #define SANGOMA_WAIT_INFINITE INFINITE
00139
00144 #define sangoma_msleep(x) Sleep(x)
00145
00151 #define sangoma_ctime(time) _ctime64(time)
00152
00153 #else
00154
00155 #include <stdlib.h>
00156 #include <stdarg.h>
00157 #include <ctype.h>
00158 #include <unistd.h>
00159 #include <sys/time.h>
00160 #include <sys/socket.h>
00161 #include <sys/ioctl.h>
00162 #include <sys/types.h>
00163 #include <sys/stat.h>
00164 #include <sys/signal.h>
00165 #include <sys/select.h>
00166 #include <sys/wait.h>
00167 #include <sys/resource.h>
00168 #include <netinet/in.h>
00169 #include <string.h>
00170 #include <errno.h>
00171 #include <fcntl.h>
00172 #include <net/if.h>
00173 #include <poll.h>
00174 #include <signal.h>
00175 #include <pthread.h>
00176 #include <stdint.h>
00177
00182 #define _LIBSNG_CALL
00183
00188 #define INVALID_HANDLE_VALUE -1
00189
00194 #define SANGOMA_INFINITE_API_POLL_WAIT -1
00195 #define SANGOMA_WAIT_INFINITE -1
00196
00238 #define __cdecl
00239
00240 #ifndef FALSE
00241 #define FALSE 0
00242 #endif
00243
00244 #ifndef TRUE
00245 #define TRUE 1
00246 #endif
00247
00248 #define sangoma_msleep(x) usleep(x*1000)
00249 #define _getch getchar
00250 #define Sleep sangoma_msleep
00251 #define _stricmp strcmp
00252 #define _snprintf snprintf
00253 #define _vsnprintf vsnprintf
00254
00255 typedef int HANDLE;
00256 typedef int DWORD;
00257 typedef char TCHAR;
00258
00259
00260 #if 0
00261 typedef int BOOL;
00262 typedef unsigned char UCHAR;
00263 typedef unsigned long ULONG;
00264 typedef unsigned short USHORT;
00265 typedef unsigned char * LPSTR;
00266 typedef unsigned char * PUCHAR;
00267 typedef void * PVOID;
00268 typedef unsigned int UINT;
00269 #endif
00270
00271 typedef void * LPTHREAD_START_ROUTINE;
00272 typedef pthread_mutex_t CRITICAL_SECTION;
00273
00274 #define EnterCriticalSection(arg) pthread_mutex_lock(arg)
00275
00276 #define TryEnterCriticalSection(arg) (pthread_mutex_trylock(arg)==0 ? 1 : 0)
00277 #define LeaveCriticalSection(arg) pthread_mutex_unlock(arg)
00278 #define InitializeCriticalSection(arg) pthread_mutex_init(arg, NULL);
00279
00280 typedef struct tm SYSTEMTIME;
00281 typedef char * LPCTSTR;
00282
00288 #define sangoma_ctime(time) ctime((time_t*)time)
00289
00290 #endif
00291
00292
00304 #ifdef LIBSANGOMA_LIGHT
00305 #include "wanpipe_api_iface.h"
00306 #include "wanpipe_api_hdr.h"
00307 #include "sdla_te1.h"
00308 #include "wanpipe_events.h"
00309 #include "wanpipe_api_deprecated.h"
00310 #else
00311 #include "wanpipe_api.h"
00312
00313 #ifdef WP_API_FEATURE_LIBSNG_HWEC
00314 # include "wanpipe_events.h"
00315 # include "wanec_api.h"
00316 # include "wanec_iface_api.h"
00317 #endif
00318 #endif
00319
00320
00321 #ifdef __LINUX__
00322 #include "wanpipe_kernel.h"
00323 #endif
00324
00335 typedef int32_t sangoma_status_t;
00336
00345 #define FNAME_LEN 100
00346 #define LIBSNG_FUNC_DBG() if(0)printf("%s(): line:%d\n", __FUNCTION__, __LINE__)
00347 #define LIBSNG_DBG_PRINT if(0)printf
00348
00353 typedef wp_api_hdr_t sangoma_api_hdr_t;
00354
00361 typedef enum _sangoma_wait_obj_type
00362 {
00364 UNKNOWN_WAIT_OBJ = 0,
00366 SANGOMA_GENERIC_WAIT_OBJ = 0,
00368 SANGOMA_DEVICE_WAIT_OBJ,
00370 SANGOMA_DEVICE_WAIT_OBJ_SIG,
00371 } sangoma_wait_obj_type_t;
00372
00373 #define DECODE_SANGOMA_WAIT_OBJECT_TYPE(type)\
00374 type == SANGOMA_GENERIC_WAIT_OBJ ? "SANGOMA_GENERIC_WAIT_OBJ" :\
00375 type == SANGOMA_DEVICE_WAIT_OBJ ? "SANGOMA_DEVICE_WAIT_OBJ" :\
00376 type == SANGOMA_DEVICE_WAIT_OBJ_SIG ? "SANGOMA_DEVICE_WAIT_OBJ_SIG" :\
00377 "Invalid Wait Object type!"
00378
00379
00380
00381
00382
00383
00384
00385 typedef enum _sangoma_wait_obj_flags {
00386 SANG_WAIT_OBJ_HAS_INPUT = WP_POLLIN,
00387 SANG_WAIT_OBJ_HAS_OUTPUT = WP_POLLOUT,
00388 SANG_WAIT_OBJ_HAS_EVENTS = WP_POLLPRI,
00389 SANG_WAIT_OBJ_IS_SIGNALED = 0x400
00390 } sangoma_wait_obj_flags_t;
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00416 sng_fd_t _LIBSNG_CALL sangoma_open_api_span_chan(int span, int chan);
00417
00418
00428 sng_fd_t _LIBSNG_CALL __sangoma_open_api_span_chan(int span, int chan);
00429 #define __sangoma_open_tdmapi_span_chan __sangoma_open_api_span_chan
00430
00439 sng_fd_t _LIBSNG_CALL sangoma_open_api_span(int span);
00440
00447 sng_fd_t _LIBSNG_CALL sangoma_open_dev_by_name(const char *dev_name);
00448
00449
00461 #ifndef LIBSANGOMA_TDMAPI_CTRL
00462 #define LIBSANGOMA_TDMAPI_CTRL 1
00463 #endif
00464
00473 sng_fd_t _LIBSNG_CALL sangoma_open_api_ctrl(void);
00474
00483 sng_fd_t _LIBSNG_CALL sangoma_logger_open(void);
00484
00493 sng_fd_t _LIBSNG_CALL sangoma_open_driver_ctrl(int port_no);
00494
00495
00496
00504 void _LIBSNG_CALL sangoma_close(sng_fd_t *fd);
00505
00506
00507
00516 int _LIBSNG_CALL sangoma_get_open_cnt(sng_fd_t fd, wanpipe_api_t *tdm_api);
00517
00518
00519
00538 int _LIBSNG_CALL sangoma_writemsg(sng_fd_t fd, void *hdrbuf, int hdrlen,
00539 void *databuf, unsigned short datalen, int flag);
00540
00541
00556 int _LIBSNG_CALL sangoma_readmsg(sng_fd_t fd, void *hdrbuf, int hdrlen,
00557 void *databuf, int datalen, int flag);
00558
00559
00560
00561
00562
00573 sangoma_status_t _LIBSNG_CALL sangoma_waitfor(sangoma_wait_obj_t *sangoma_wait_obj, uint32_t inflags, uint32_t *outflags, int32_t timeout);
00574
00585 sangoma_status_t _LIBSNG_CALL sangoma_waitfor_many(sangoma_wait_obj_t *sangoma_wait_objects[], uint32_t in_flags[], uint32_t out_flags[],
00586 uint32_t number_of_sangoma_wait_objects, int32_t system_wait_timeout);
00587
00597 sangoma_status_t _LIBSNG_CALL sangoma_wait_obj_create(sangoma_wait_obj_t **sangoma_wait_object, sng_fd_t fd, sangoma_wait_obj_type_t object_type);
00598
00605 sangoma_status_t _LIBSNG_CALL sangoma_wait_obj_delete(sangoma_wait_obj_t **sangoma_wait_object);
00606
00613 sangoma_status_t _LIBSNG_CALL sangoma_wait_obj_signal(sangoma_wait_obj_t *sangoma_wait_object);
00614
00621 sng_fd_t _LIBSNG_CALL sangoma_wait_obj_get_fd(sangoma_wait_obj_t *sangoma_wait_object);
00622
00631 void _LIBSNG_CALL sangoma_wait_obj_set_context(sangoma_wait_obj_t *sangoma_wait_object, void *context);
00632
00640 PVOID _LIBSNG_CALL sangoma_wait_obj_get_context(sangoma_wait_obj_t *sangoma_wait_object);
00641
00642
00643
00654 int _LIBSNG_CALL sangoma_cmd_exec(sng_fd_t fd, wanpipe_api_t *tdm_api);
00655
00656
00664 int _LIBSNG_CALL sangoma_get_full_cfg(sng_fd_t fd, wanpipe_api_t *tdm_api);
00665
00676 int _LIBSNG_CALL sangoma_tdm_set_usr_period(sng_fd_t fd, wanpipe_api_t *tdm_api, int period);
00677
00685 int _LIBSNG_CALL sangoma_tdm_get_usr_period(sng_fd_t fd, wanpipe_api_t *tdm_api);
00686
00694 int _LIBSNG_CALL sangoma_tdm_get_usr_mtu_mru(sng_fd_t fd, wanpipe_api_t *tdm_api);
00695
00696
00705 int _LIBSNG_CALL sangoma_flush_bufs(sng_fd_t fd, wanpipe_api_t *tdm_api);
00706
00715 int _LIBSNG_CALL sangoma_flush_rx_bufs(sng_fd_t fd, wanpipe_api_t *tdm_api);
00724 int _LIBSNG_CALL sangoma_flush_tx_bufs(sng_fd_t fd, wanpipe_api_t *tdm_api);
00725
00734 int _LIBSNG_CALL sangoma_flush_event_bufs(sng_fd_t fd, wanpipe_api_t *tdm_api);
00735
00736
00745 int _LIBSNG_CALL sangoma_tdm_enable_rbs_events(sng_fd_t fd, wanpipe_api_t *tdm_api, int poll_in_sec);
00746
00754 int _LIBSNG_CALL sangoma_tdm_disable_rbs_events(sng_fd_t fd, wanpipe_api_t *tdm_api);
00755
00765 int _LIBSNG_CALL sangoma_tdm_write_rbs(sng_fd_t fd, wanpipe_api_t *tdm_api, int channel, unsigned char rbs);
00766
00777 int _LIBSNG_CALL sangoma_tdm_read_rbs(sng_fd_t fd, wanpipe_api_t *tdm_api, int channel, unsigned char *rbs);
00778
00788 int _LIBSNG_CALL sangoma_tdm_enable_dtmf_events(sng_fd_t fd, wanpipe_api_t *tdm_api);
00789
00799 int _LIBSNG_CALL sangoma_tdm_disable_dtmf_events(sng_fd_t fd, wanpipe_api_t *tdm_api);
00800
00801
00802 #ifdef WP_API_FEATURE_FAX_EVENTS
00803
00812 int _LIBSNG_CALL sangoma_tdm_enable_fax_events(sng_fd_t fd, wanpipe_api_t *tdm_api);
00813
00823 int _LIBSNG_CALL sangoma_tdm_disable_fax_events(sng_fd_t fd, wanpipe_api_t *tdm_api);
00824
00834 int _LIBSNG_CALL sangoma_tdm_get_hw_fax(sng_fd_t fd, wanpipe_api_t *tdm_api);
00835
00836 #endif
00837
00838
00848 int _LIBSNG_CALL sangoma_tdm_enable_rm_dtmf_events(sng_fd_t fd, wanpipe_api_t *tdm_api);
00849
00859 int _LIBSNG_CALL sangoma_tdm_disable_rm_dtmf_events(sng_fd_t fd, wanpipe_api_t *tdm_api);
00860
00870 int _LIBSNG_CALL sangoma_tdm_enable_rxhook_events(sng_fd_t fd, wanpipe_api_t *tdm_api);
00871
00881 int _LIBSNG_CALL sangoma_tdm_disable_rxhook_events(sng_fd_t fd, wanpipe_api_t *tdm_api);
00882
00892 int _LIBSNG_CALL sangoma_tdm_enable_ring_events(sng_fd_t fd, wanpipe_api_t *tdm_api);
00893
00903 int _LIBSNG_CALL sangoma_tdm_disable_ring_events(sng_fd_t fd, wanpipe_api_t *tdm_api);
00904
00905
00915 int _LIBSNG_CALL sangoma_tdm_enable_ring_detect_events(sng_fd_t fd, wanpipe_api_t *tdm_api);
00916
00926 int _LIBSNG_CALL sangoma_tdm_disable_ring_detect_events(sng_fd_t fd, wanpipe_api_t *tdm_api);
00927
00937 int _LIBSNG_CALL sangoma_tdm_enable_ring_trip_detect_events(sng_fd_t fd, wanpipe_api_t *tdm_api);
00938
00948 int _LIBSNG_CALL sangoma_tdm_disable_ring_trip_detect_events(sng_fd_t fd, wanpipe_api_t *tdm_api);
00949
00960 int _LIBSNG_CALL sangoma_tdm_enable_tone_events(sng_fd_t fd, wanpipe_api_t *tdm_api, uint16_t tone_id);
00961
00971 int _LIBSNG_CALL sangoma_tdm_disable_tone_events(sng_fd_t fd, wanpipe_api_t *tdm_api);
00972
00982 int _LIBSNG_CALL sangoma_tdm_txsig_onhook(sng_fd_t fd, wanpipe_api_t *tdm_api);
00983
00993 int _LIBSNG_CALL sangoma_tdm_txsig_offhook(sng_fd_t fd, wanpipe_api_t *tdm_api);
00994
01004 int _LIBSNG_CALL sangoma_tdm_txsig_start(sng_fd_t fd, wanpipe_api_t *tdm_api);
01005
01015 int _LIBSNG_CALL sangoma_tdm_txsig_kewl(sng_fd_t fd, wanpipe_api_t *tdm_api);
01016
01026 int _LIBSNG_CALL sangoma_tdm_enable_hwec(sng_fd_t fd, wanpipe_api_t *tdm_api);
01027
01037 int _LIBSNG_CALL sangoma_tdm_disable_hwec(sng_fd_t fd, wanpipe_api_t *tdm_api);
01038
01049 int _LIBSNG_CALL sangoma_tdm_get_fe_alarms(sng_fd_t fd, wanpipe_api_t *tdm_api, unsigned int *alarms);
01050
01051
01052
01053 #ifdef WP_API_FEATURE_LINK_STATUS
01054 # ifndef LIBSANGOMA_GET_LINKSTATUS
01055
01059 # define LIBSANGOMA_GET_LINKSTATUS 1
01060 # endif
01061
01071 int _LIBSNG_CALL sangoma_get_link_status(sng_fd_t fd, wanpipe_api_t *tdm_api, unsigned char *current_status);
01072
01073 #endif
01074
01075
01076 #ifndef LIBSANGOMA_GET_FESTATUS
01077
01081 #define LIBSANGOMA_GET_FESTATUS 1
01082 #endif
01083
01092 int _LIBSNG_CALL sangoma_set_fe_status(sng_fd_t fd, wanpipe_api_t *tdm_api, unsigned char new_status);
01093
01094
01095
01096 #ifdef WP_API_FEATURE_BUFFER_MULT
01097
01105 int _LIBSNG_CALL sangoma_tdm_set_buffer_multiplier(sng_fd_t fd, wanpipe_api_t *tdm_api, unsigned int multiplier);
01106
01107 #endif
01108
01109
01119 int _LIBSNG_CALL sangoma_enable_bri_bchan_loopback(sng_fd_t fd, wanpipe_api_t *tdm_api, int channel);
01120
01130 int _LIBSNG_CALL sangoma_disable_bri_bchan_loopback(sng_fd_t fd, wanpipe_api_t *tdm_api, int channel);
01131
01132
01140 int _LIBSNG_CALL sangoma_get_tx_queue_sz(sng_fd_t fd, wanpipe_api_t *tdm_api);
01141
01142
01151 int _LIBSNG_CALL sangoma_set_tx_queue_sz(sng_fd_t fd, wanpipe_api_t *tdm_api, int size);
01152
01160 int _LIBSNG_CALL sangoma_get_rx_queue_sz(sng_fd_t fd, wanpipe_api_t *tdm_api);
01161
01170 int _LIBSNG_CALL sangoma_set_rx_queue_sz(sng_fd_t fd, wanpipe_api_t *tdm_api, int size);
01171
01172
01173 #ifndef LIBSANGOMA_GET_HWCODING
01174
01178 #define LIBSANGOMA_GET_HWCODING 1
01179 #endif
01180
01188 int _LIBSNG_CALL sangoma_get_hw_coding(sng_fd_t fd, wanpipe_api_t *tdm_api);
01189
01190
01191
01192 #ifndef LIBSANGOMA_GET_HWDTMF
01193
01197 #define LIBSANGOMA_GET_HWDTMF 1
01198 #endif
01199
01208 int _LIBSNG_CALL sangoma_tdm_get_hw_dtmf(sng_fd_t fd, wanpipe_api_t *tdm_api);
01209
01219 int _LIBSNG_CALL sangoma_tdm_get_hw_ec(sng_fd_t fd, wanpipe_api_t *tdm_api);
01220
01221
01222 #ifdef WP_API_FEATURE_EC_CHAN_STAT
01223
01234 int _LIBSNG_CALL sangoma_tdm_get_hwec_chan_status(sng_fd_t fd, wanpipe_api_t *tdm_api);
01235
01236 #endif
01237
01238 #ifdef WP_API_FEATURE_HWEC_PERSIST
01239
01249 int _LIBSNG_CALL sangoma_tdm_get_hwec_persist_status(sng_fd_t fd, wanpipe_api_t *tdm_api);
01250 #endif
01251
01260 int _LIBSNG_CALL sangoma_span_chan_toif(int span, int chan, char *interface_name);
01261
01270 int _LIBSNG_CALL sangoma_span_chan_fromif(char *interface_name, int *span, int *chan);
01271
01272
01281 int _LIBSNG_CALL sangoma_interface_wait_up(int span, int chan, int sectimeout);
01282
01291 int _LIBSNG_CALL sangoma_get_driver_version(sng_fd_t fd, wanpipe_api_t *tdm_api, wan_driver_version_t *drv_ver);
01292
01301 int _LIBSNG_CALL sangoma_get_firmware_version(sng_fd_t fd, wanpipe_api_t *tdm_api, unsigned char *ver);
01302
01311 int _LIBSNG_CALL sangoma_get_cpld_version(sng_fd_t fd, wanpipe_api_t *tdm_api, unsigned char *ver);
01312
01322 int _LIBSNG_CALL sangoma_get_aft_customer_id(sng_fd_t fd, unsigned char *out_customer_id);
01323
01324 #ifdef WP_API_FEATURE_LED_CTRL
01325
01334 int _LIBSNG_CALL sangoma_port_led_ctrl(sng_fd_t fd, unsigned char led_state);
01335
01336 #endif
01337
01338
01339 #ifdef WP_API_FEATURE_FE_RW
01340
01350 int _LIBSNG_CALL sangoma_fe_reg_write(sng_fd_t fd, uint32_t offset, uint8_t data);
01351
01360 int _LIBSNG_CALL sangoma_fe_reg_read(sng_fd_t fd, uint32_t offset, uint8_t *data);
01361 #endif
01362
01371 int _LIBSNG_CALL sangoma_get_stats(sng_fd_t fd, wanpipe_api_t *tdm_api, wanpipe_chan_stats_t *stats);
01372
01380 int _LIBSNG_CALL sangoma_flush_stats(sng_fd_t fd, wanpipe_api_t *tdm_api);
01381
01390 int _LIBSNG_CALL sangoma_set_rm_rxflashtime(sng_fd_t fd, wanpipe_api_t *tdm_api, int rxflashtime);
01391
01392 #ifdef WP_API_FEATURE_RM_GAIN
01393
01401 int _LIBSNG_CALL sangoma_set_rm_tx_gain(sng_fd_t fd, wanpipe_api_t *tdm_api, int value);
01402
01403
01412 int _LIBSNG_CALL sangoma_set_rm_rx_gain(sng_fd_t fd, wanpipe_api_t *tdm_api, int value);
01413
01414 #endif
01415
01424 int _LIBSNG_CALL sangoma_tdm_set_polarity(sng_fd_t fd, wanpipe_api_t *tdm_api, int polarity);
01425
01435 int _LIBSNG_CALL sangoma_tdm_txsig_onhooktransfer(sng_fd_t fd, wanpipe_api_t *tdm_api);
01436
01437
01438 #ifdef WP_API_FEATURE_LOOP
01439
01446 int _LIBSNG_CALL sangoma_tdm_enable_loop(sng_fd_t fd, wanpipe_api_t *tdm_api);
01447
01455 int _LIBSNG_CALL sangoma_tdm_disable_loop(sng_fd_t fd, wanpipe_api_t *tdm_api);
01456 #endif
01457
01458
01474 int _LIBSNG_CALL sangoma_read_event(sng_fd_t fd, wanpipe_api_t *tdm_api);
01475
01476 #ifdef WP_API_FEATURE_LOGGER
01477
01478 sangoma_status_t _LIBSNG_CALL sangoma_logger_cmd_exec(sng_fd_t fd, wp_logger_cmd_t *logger_cmd);
01479
01491 sangoma_status_t _LIBSNG_CALL sangoma_logger_read_event(sng_fd_t fd, wp_logger_cmd_t *logger_cmd);
01492
01500 sangoma_status_t _LIBSNG_CALL sangoma_logger_flush_buffers(sng_fd_t fd, wp_logger_cmd_t *logger_cmd);
01501
01509 sangoma_status_t _LIBSNG_CALL sangoma_logger_get_statistics(sng_fd_t fd, wp_logger_cmd_t *logger_cmd);
01510
01518 sangoma_status_t _LIBSNG_CALL sangoma_logger_reset_statistics(sng_fd_t fd, wp_logger_cmd_t *logger_cmd);
01519
01527 sangoma_status_t _LIBSNG_CALL sangoma_logger_get_open_handle_counter(sng_fd_t fd, wp_logger_cmd_t *logger_cmd);
01528
01536 sangoma_status_t _LIBSNG_CALL sangoma_logger_get_logger_level(sng_fd_t fd, wp_logger_cmd_t *logger_cmd);
01537
01545 sangoma_status_t _LIBSNG_CALL sangoma_logger_set_logger_level(sng_fd_t fd, wp_logger_cmd_t *logger_cmd);
01546
01547 #endif
01548
01549
01550 #ifdef WP_API_FEATURE_DRIVER_GAIN
01551
01559 int _LIBSNG_CALL sangoma_set_tx_gain(sng_fd_t fd, wanpipe_api_t *tdm_api, float gain_val);
01560
01569 int _LIBSNG_CALL sangoma_set_rx_gain(sng_fd_t fd, wanpipe_api_t *tdm_api, float gain_val);
01570
01578 int _LIBSNG_CALL sangoma_clear_tx_gain(sng_fd_t fd, wanpipe_api_t *tdm_api);
01579
01587 int _LIBSNG_CALL sangoma_clear_rx_gain(sng_fd_t fd, wanpipe_api_t *tdm_api);
01588 #endif
01589
01590 #ifndef LIBSANGOMA_LIGHT
01591
01592
01610 int _LIBSNG_CALL sangoma_driver_port_start(sng_fd_t fd, port_management_struct_t *port_mgmnt, unsigned short port_no);
01611
01612
01627 int _LIBSNG_CALL sangoma_driver_port_stop(sng_fd_t fd, port_management_struct_t *port_mgmnt, unsigned short port_no);
01628
01629
01646 int _LIBSNG_CALL sangoma_driver_port_set_config(sng_fd_t fd, port_cfg_t *port_cfg, unsigned short port_no);
01647
01648
01662 int _LIBSNG_CALL sangoma_driver_port_get_config(sng_fd_t fd, port_cfg_t *port_cfg, unsigned short port_no);
01663
01664
01677 int _LIBSNG_CALL sangoma_driver_get_hw_info(sng_fd_t fd, port_management_struct_t *port_mgmnt, unsigned short port_no);
01678
01679
01693 int _LIBSNG_CALL sangoma_driver_get_version(sng_fd_t fd, port_management_struct_t *port_mgmnt, unsigned short port_no);
01694
01695
01696
01697
01698 #ifdef WP_API_FEATURE_HARDWARE_RESCAN
01699
01711 int _LIBSNG_CALL sangoma_driver_hw_rescan(sng_fd_t fd, port_management_struct_t *port_mgmnt, int *detected_port_cnt);
01712 #endif
01713
01730 int _LIBSNG_CALL sangoma_write_port_config_on_persistent_storage(hardware_info_t *hardware_info, port_cfg_t *port_cfg, unsigned short port_no);
01731
01732
01733
01744 int _LIBSNG_CALL sangoma_mgmt_cmd(sng_fd_t fd, wan_udp_hdr_t* wan_udp);
01745
01746
01747 #endif
01748
01749
01750
01751
01752
01753
01754
01755
01756 #ifndef LIBSANGOMA_SET_FESTATUS
01757
01761 #define LIBSANGOMA_SET_FESTATUS 1
01762 #endif
01763
01774 int _LIBSNG_CALL sangoma_get_fe_status(sng_fd_t fd, wanpipe_api_t *tdm_api, unsigned char *current_status);
01775
01776
01777
01789 int _LIBSNG_CALL sangoma_tdm_set_codec(sng_fd_t fd, wanpipe_api_t *tdm_api, int codec);
01790
01801 int _LIBSNG_CALL sangoma_tdm_get_codec(sng_fd_t fd, wanpipe_api_t *tdm_api);
01802
01803
01813 sng_fd_t _LIBSNG_CALL sangoma_create_socket_by_name(char *device, char *card);
01814
01824 int _LIBSNG_CALL sangoma_interface_toi(char *interface_name, int *span, int *chan);
01825
01826
01837 int _LIBSNG_CALL sangoma_tdm_set_power_level(sng_fd_t fd, wanpipe_api_t *tdm_api, int power);
01838
01848 int _LIBSNG_CALL sangoma_tdm_get_power_level(sng_fd_t fd, wanpipe_api_t *tdm_api);
01849
01850
01851
01852
01853 #ifdef WP_API_FEATURE_LIBSNG_HWEC
01854
01891 sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_init(char *device_name, wan_custom_param_t custom_params[], unsigned int number_of_custom_params);
01892
01909 sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_release(char *device_name);
01910
01929 sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_operation_mode(char *device_name, int mode, unsigned int fe_chan_map);
01930
01948 sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_power_on(char *device_name, unsigned int fe_chan_map);
01949
01968 sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_power_off(char *device_name, unsigned int fe_chan_map);
01969
01993 sangoma_status_t _LIBSNG_CALL sangoma_hwec_enable(char *device_name, unsigned int fe_chan_map);
01994
02016 sangoma_status_t _LIBSNG_CALL sangoma_hwec_disable(char *device_name, unsigned int fe_chan_map);
02017
02059 sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_channel_parameter(char *device_name, char *parameter, char *parameter_value, unsigned int channel_map);
02060
02083 sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_tone_detection(char *device_name, int tone_id, int enable, unsigned int fe_chan_map, unsigned char port_map);
02084
02101 sangoma_status_t _LIBSNG_CALL sangoma_hwec_print_statistics(char *device_name, int full, unsigned int fe_chan_map);
02102
02120 sangoma_status_t _LIBSNG_CALL sangoma_hwec_audio_buffer_load(char *device_name, char *filename, char pcmlaw, int *out_buffer_id);
02121
02136 sangoma_status_t _LIBSNG_CALL sangoma_hwec_audio_mem_buffer_load(char *device_name, unsigned char *buffer, unsigned int in_size, char pcmlaw, int *out_buffer_id);
02137
02149 sangoma_status_t _LIBSNG_CALL sangoma_hwec_audio_buffer_unload(char *device_name, int in_buffer_id);
02150
02176 sangoma_status_t _LIBSNG_CALL sangoma_hwec_audio_buffer_playout(char *device_name, unsigned int fe_chan_map,
02177 unsigned char port, int in_buffer_id, int start,
02178 int repeat_cnt, int duration);
02179
02191 sangoma_status_t _LIBSNG_CALL sangoma_hwec_config_verbosity(int verbosity_level);
02192
02204 void _LIBSNG_CALL sangoma_hwec_initialize_custom_parameter_structure(wan_custom_param_t *custom_param, char *parameter_name, char *parameter_value);
02205
02206
02228 sangoma_status_t _LIBSNG_CALL sangoma_hwec_get_channel_statistics(sng_fd_t fd, unsigned int fe_chan,
02229 int *hwec_api_return_code, wanec_chan_stats_t *wanec_chan_stats, int verbose, int reset);
02230
02231
02250 sangoma_status_t _LIBSNG_CALL sangoma_hwec_get_global_chip_statistics(sng_fd_t fd,
02251 int *hwec_api_return_code, wanec_chip_stats_t *wanec_chip_stats, int verbose, int reset);
02252
02253
02270 sangoma_status_t _LIBSNG_CALL sangoma_hwec_get_chip_image_info(sng_fd_t fd,
02271 int *hwec_api_return_code, wanec_chip_image_t *wanec_chip_image, int verbose);
02272
02273 #endif
02274
02275
02276 #ifdef __cplusplus
02277 }
02278 #endif
02279
02280
02281 #if defined(__WINDOWS__)
02282
02283 #ifdef __cplusplus
02284 extern "C" {
02285 #endif
02286
02287 sangoma_status_t _LIBSNG_CALL sangoma_unload_driver();
02288 sangoma_status_t _LIBSNG_CALL sangoma_load_driver();
02289 void _LIBSNG_CALL sangoma_reset_port_numbers();
02290 sangoma_status_t _LIBSNG_CALL sangoma_get_driver_version_from_registry(char *out_buffer, int out_buffer_length);
02291 sangoma_status_t _LIBSNG_CALL sangoma_set_driver_mode_of_all_hw_devices(int driver_mode);
02292
02293 #ifdef __cplusplus
02294 }
02295 #endif
02296
02297 #else
02298
02299 #define sangoma_open_tdmapi_span_chan sangoma_open_api_span_chan
02300 #define sangoma_open_tdmapi_span sangoma_open_api_span
02301 #define sangoma_open_tdmapi_ctrl sangoma_open_api_ctrl
02302 #define sangoma_tdm_get_fe_status sangoma_get_fe_status
02303 #define sangoma_socket_close sangoma_close
02304 #define sangoma_tdm_get_hw_coding sangoma_get_hw_coding
02305 #define sangoma_tdm_set_fe_status sangoma_set_fe_status
02306 #define sangoma_tdm_get_link_status sangoma_get_link_status
02307 #define sangoma_tdm_flush_bufs sangoma_flush_bufs
02308 #define sangoma_tdm_cmd_exec sangoma_cmd_exec
02309 #define sangoma_tdm_read_event sangoma_read_event
02310 #define sangoma_readmsg_tdm sangoma_readmsg
02311 #define sangoma_readmsg_socket sangoma_readmsg
02312 #define sangoma_sendmsg_socket sangoma_writemsg
02313 #define sangoma_writemsg_tdm sangoma_writemsg
02314 #define sangoma_create_socket_intr sangoma_open_api_span_chan
02315 #endif
02316
02317 #endif
02318