Functions

# Configuration
[LibTDS API]

Handle reading of configuration. More...

## Functions
static int | hex2num (char *hex)
static int | hexdigit (int c)
static int | parse_server_name_for_port (TDSCONNECTION *connection, TDSLOGIN *login)
| Check the server name to find port info first Warning: connection-> & login-> are all modified when needed.
static int | search_interface_file (TDSCONNECTION *connection, const char *dir, const char *file, const char *host)
| Open and read the file 'file' searching for a logical server by the name of 'host'.
static int | tds_config_boolean (const char *value)
static void | tds_config_encryption (const char *value, TDSCONNECTION *connection)
static void | tds_config_env_tdsdump (TDSCONNECTION *connection)
static void | tds_config_env_tdshost (TDSCONNECTION *connection)
static void | tds_config_env_tdsport (TDSCONNECTION *connection)
static void | tds_config_env_tdsver (TDSCONNECTION *connection)
static void | tds_config_login (TDSCONNECTION *connection, TDSLOGIN *login)
void | tds_config_verstr (const char *tdsver, TDSCONNECTION *connection)
| Set TDS version from given string.
void | tds_fix_connection (TDSCONNECTION *connection)
| Fix configuration after reading it.
const TDS_COMPILETIME_SETTINGS * | tds_get_compiletime_settings (void)
| Return a structure capturing the compile-time settings provided to the configure script.
static char * | tds_get_home_file (const char *file)
| Return filename from HOME directory.
void | tds_lookup_host (const char *servername, char *ip)
| Given a servername lookup the hostname.
static int | tds_lookup_port (const char *portname)
| Given a portname lookup the port.
static void | tds_parse_conf_section (const char *option, const char *value, void *param)
int | tds_read_conf_file (TDSCONNECTION *connection, const char *server)
| Read configuration info for given server return 0 on error.
int | tds_read_conf_section (FILE *in, const char *section, TDSCONFPARSE tds_conf_parse, void *param)
| Read a section of configuration file (INI style file)
static int | tds_read_conf_sections (FILE *in, const char *server, TDSCONNECTION *connection)
TDSCONNECTION * | tds_read_config_info (TDSSOCKET *tds, TDSLOGIN *login, TDSLOCALE *locale)
| tds_read_config_info() will fill the tds connection structure based on configuration information gathered in the following order: 1) Program specified in TDSLOGIN structure 2) The environment variables TDSVER, TDSDUMP, TDSPORT, TDSQUERY, TDSHOST 3) A config file with the following search order: a) a readable file specified by environment variable FREETDSCONF b) a readable file in ~/.freetds.conf c) a readable file in $prefix/etc/freetds.conf 3) ~/.interfaces if exists 4) $SYBASE/interfaces if exists 5) TDS_DEF_* default values
static void | tds_read_interfaces (const char *server, TDSCONNECTION *connection)
| Try to find the IP number and port for a (possibly) logical server name.
int | tds_set_interfaces_file_loc (const char *interf)
| Set the full name of interface file.
static int | tds_try_conf_file (const char *path, const char *how, const char *server, TDSCONNECTION *connection)

## Detailed Description

Handle reading of configuration.

## Function Documentation

static int parse_server_name_for_port | ( | TDSCONNECTION * | connection,
|  | TDSLOGIN * | login
| ) |  | `[static]`

Check the server name to find port info first Warning: connection-> & login-> are all modified when needed.

Returns:
  1 when found, else 0

static int search_interface_file | ( | TDSCONNECTION * | connection,
|  | const char * | dir,
|  | const char * | file,
|  | const char * | host
| ) |  | `[static]`

Open and read the file 'file' searching for a logical server by the name of 'host'.

If one is found then lookup the IP address and port number and store them in 'connection'

Parameters:

  dir | name of base directory for interface file
  file | name of the interface file
  host | logical host to search for

Returns:
  0 if not fount 1 if found

void tds_config_verstr | ( | const char * | tdsver,
|  | TDSCONNECTION * | connection
| ) |  |

Set TDS version from given string.

Parameters:

  tdsver | tds string version
  connection | where to store information

void tds_fix_connection | ( | TDSCONNECTION * | connection ) |

Fix configuration after reading it.

Currently this read some environment variables and replace some options.

static char* tds_get_home_file | ( | const char * | file ) | `[static]`

Return filename from HOME directory.

Returns:
  allocated string or NULL if error

void tds_lookup_host | ( | const char * | servername,
|  | char * | ip
| ) |  |

Given a servername lookup the hostname.

The server ip will be stored in the string 'ip' in dotted-decimal notation.

If we can't determine the IP address then 'ip' will be set to empty string.

static int tds_lookup_port | ( | const char * | portname ) | `[static]`

Given a portname lookup the port.

If we can't determine the port number than function return 0.

int tds_read_conf_file | ( | TDSCONNECTION * | connection,
|  | const char * | server
| ) |  |

Read configuration info for given server return 0 on error.

Parameters:

  connection | where to store configuration
  server | section of file configuration that hold configuration for a server

int tds_read_conf_section | ( | FILE * | in,
|  | const char * | section,
|  | TDSCONFPARSE | tds_conf_parse,
|  | void * | param
| ) |  |

Read a section of configuration file (INI style file)

Parameters:

  in | configuration file
  section | section to read
  tds_conf_parse | callback that receive every entry in section
  param | parameter to pass to callback function

TDSCONNECTION* tds_read_config_info | ( | TDSSOCKET * | tds,
|  | TDSLOGIN * | login,
|  | TDSLOCALE * | locale
| ) |  |

tds_read_config_info() will fill the tds connection structure based on configuration information gathered in the following order: 1) Program specified in TDSLOGIN structure 2) The environment variables TDSVER, TDSDUMP, TDSPORT, TDSQUERY, TDSHOST 3) A config file with the following search order: a) a readable file specified by environment variable FREETDSCONF b) a readable file in ~/.freetds.conf c) a readable file in $prefix/etc/freetds.conf 3) ~/.interfaces if exists 4) $SYBASE/interfaces if exists 5) TDS_DEF_* default values

.tdsrc and freetds.conf have been added to make the package easier to integration with various Linux and *BSD distributions.

static void tds_read_interfaces | ( | const char * | server,
|  | TDSCONNECTION * | connection
| ) |  | `[static]`

Try to find the IP number and port for a (possibly) logical server name.

Note:
  This function uses only the interfaces file and is deprecated.

int tds_set_interfaces_file_loc | ( | const char * | interf ) |

Set the full name of interface file.

Parameters:

  interf | file name

All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines