33 #include "libsangoma-pvt.h"
36 #ifndef LIBSANGOMA_LIGHT
45 #if defined(__WINDOWS__)
49 IoctlPortManagementCommand,
50 (LPVOID)port_management,
51 sizeof(port_management_struct_t),
52 (LPVOID)port_management,
53 sizeof(port_management_struct_t),
58 DBG_ERR(
"%s():Error: IoctlPortManagementCommand failed!!\n", __FUNCTION__);
74 int sangoma_port_cfg_ioctl(
sng_fd_t fd, port_cfg_t *port_cfg)
77 #if defined(__WINDOWS__)
81 IoctlPortConfigurationCommand,
90 DBG_ERR(
"%s():Error: IoctlPortConfigurationCommand failed!!\n", __FUNCTION__);
111 #if defined(__WINDOWS__)
116 _snprintf(tmp_fname, DEV_NAME_LEN, WP_CONFIG_DEV_NAME);
125 #if defined(__WINDOWS__)
126 if(UdpManagementCommand(fd, wan_udp)){
130 unsigned char id = 0;
132 wan_udp->wan_udphdr_request_reply = 0x01;
133 wan_udp->wan_udphdr_id = id;
134 wan_udp->wan_udphdr_return_code = WAN_UDP_TIMEOUT_CMD;
155 port_mgmnt->command_code = START_PORT_VOLATILE_CONFIG;
156 port_mgmnt->port_no = port_no;
164 return port_mgmnt->operation_status;
171 port_mgmnt->command_code = STOP_PORT;
172 port_mgmnt->port_no = port_no;
180 switch(port_mgmnt->operation_status)
189 err = port_mgmnt->operation_status;
200 port_mgmnt->command_code = GET_HARDWARE_INFO;
201 port_mgmnt->port_no = port_no;
208 return port_mgmnt->operation_status;
214 port_mgmnt->command_code = GET_DRIVER_VERSION;
215 port_mgmnt->port_no = port_no;
222 return port_mgmnt->operation_status;
225 #ifdef WP_API_FEATURE_HARDWARE_RESCAN
229 port_mgmnt->command_code = WANPIPE_HARDWARE_RESCAN;
230 port_mgmnt->port_no = 1;
237 *cnt=port_mgmnt->port_no;
239 return port_mgmnt->operation_status;
247 port_cfg->command_code = SET_PORT_VOLATILE_CONFIG;
248 port_cfg->port_no = port_no;
250 return sangoma_port_cfg_ioctl(fd, port_cfg);
256 port_cfg->command_code = GET_PORT_VOLATILE_CONFIG;
257 port_cfg->port_no = port_no;
258 return sangoma_port_cfg_ioctl(fd, port_cfg);
261 int _LIBSNG_CALL sangoma_write_port_config_on_persistent_storage(hardware_info_t *hardware_info, port_cfg_t *port_cfg,
unsigned short port_no)
264 #if defined(__WINDOWS__)
265 HKEY hPortRegistryKey = registry_open_port_key(hardware_info);
275 if(registry_write_front_end_cfg(hPortRegistryKey, port_cfg)){
280 if(registry_write_wan_tdmv_conf(hPortRegistryKey, port_cfg)){
285 err = registry_set_integer_value(hPortRegistryKey,
"aft_number_of_logic_channels", port_cfg->num_of_ifs);
291 for(ind = 0; ind < port_cfg->num_of_ifs; ind++){
292 registry_write_channel_group_cfg(hPortRegistryKey, port_cfg, ind, port_cfg->if_cfg[ind]);
296 printf(
"%s(): Warning: function not implemented\n", __FUNCTION__);
int _LIBSNG_CALL sangoma_driver_port_set_config(sng_fd_t fd, port_cfg_t *port_cfg, unsigned short port_no)
Set Port's "Volatile" configuration. The configuration will not persist between system restarts...
#define INVALID_HANDLE_VALUE
Invalid file handle value -1, Ported from Windows.
Wanpipe API Library header for Sangoma AFT T1/E1/Analog/BRI/Serial Hardware -.
#define FALSE
FALSE value is 0, Ported from Windows.
#define _snprintf
_snprintf type mapped to snprintf, Ported from Windows
int _LIBSNG_CALL sangoma_mgmt_cmd(sng_fd_t fd, wan_udp_hdr_t *wan_udp)
Execute Sangoma Management Command.
sng_fd_t _LIBSNG_CALL sangoma_open_driver_ctrl(int port_no)
Open a Global Driver Control Device.
int sng_fd_t
Windows/Unix file handle abstraction.
int _LIBSNG_CALL sangoma_driver_port_get_config(sng_fd_t fd, port_cfg_t *port_cfg, unsigned short port_no)
Retrieve Port's "Volatile" configuration.
Wanpipe UDP Structure used for Maintenance and Debugging.
#define FNAME_LEN
string length of a file name
#define _LIBSNG_CALL
Not used in Linux.
int _LIBSNG_CALL sangoma_driver_hw_rescan(sng_fd_t fd, port_management_struct_t *port_mgmnt, int *cnt)
Rescan the pci and usb bus for newly added hardware.
int _LIBSNG_CALL sangoma_driver_get_hw_info(sng_fd_t fd, port_management_struct_t *port_mgmnt, unsigned short port_no)
Retrieve information about a single instance of Sangoma hardware.
int DWORD
DWORD type is int, Ported from Windows.
int sangoma_port_mgmnt_ioctl(sng_fd_t fd, port_management_struct_t *port_management)
sng_fd_t _LIBSNG_CALL sangoma_open_dev_by_name(const char *dev_name)
Open API device using it's name. For example: Linux: w1g1, Windows wanpipe1_if1.
int _LIBSNG_CALL sangoma_driver_get_version(sng_fd_t fd, port_management_struct_t *port_mgmnt, unsigned short port_no)
Retrieve Driver Version BEFORE any communication interface is configured and sangoma_get_driver_versi...
int _LIBSNG_CALL sangoma_driver_port_stop(sng_fd_t fd, port_management_struct_t *port_mgmnt, unsigned short port_no)
Start a Port, create Sangoma Communication interfaces.
#define WP_PORT_NAME_FORM
String define of a wanpipe port name.
int _LIBSNG_CALL sangoma_driver_port_start(sng_fd_t fd, port_management_struct_t *port_mgmnt, unsigned short port_no)
Start a Port, create Sangoma Communication interfaces.