FreeTDS API: Configuration

FreeTDS API

Loading...
Searching...
No Matches
Configuration
LibTDS API

Handle reading of configuration. More...

Collaboration diagram for Configuration:

## Classes
struct | tdsvername_t

## Macros
#define | TDS_FIND(k, b, c)

## Functions
static int | hex2num (char *hex)
static int | hexdigit (int c)
static bool | parse_server_name_for_port (TDSLOGIN *connection, TDSLOGIN *login, bool update_server)
| Check the server name to find port info first Warning: connection-> & login-> are all modified when needed.
static bool | search_interface_file (TDSLOGIN *login, const tds_dir_char *dir, const tds_dir_char *file, const char *host)
| Open and read the file 'file' searching for a logical server by the name of 'host'.
TDSRET | tds8_adjust_login (TDSLOGIN *login)
| Make sure proper setting are in place for TDS 8.0.
int | tds_config_boolean (const char *option, const char *value, TDSLOGIN *login)
static bool | tds_config_encryption (const char *value, TDSLOGIN *login)
static bool | tds_config_env_tdsdump (TDSLOGIN *login)
static bool | tds_config_env_tdshost (TDSLOGIN *login)
static void | tds_config_env_tdsport (TDSLOGIN *login)
static void | tds_config_env_tdsver (TDSLOGIN *login)
static bool | tds_config_login (TDSLOGIN *connection, TDSLOGIN *login)
TDS_USMALLINT * | tds_config_verstr (const char *tdsver, TDSLOGIN *login)
| Set TDS version from given string.
static const void * | tds_find (const void *key, const void *base, size_t nelem, size_t width, int(*compar)(const void *, const void *))
void | tds_fix_login (TDSLOGIN *login)
| 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.
struct addrinfo * | tds_lookup_host (const char *servername)
| Get the IP address for a hostname.
TDSRET | tds_lookup_host_set (const char *servername, struct addrinfo **addr)
static int | tds_lookup_port (const char *portname)
| Given a portname lookup the port.
int | tds_parse_boolean (const char *value, int default_value)
static int | tds_parse_boolean_option (const char *option, const char *value, int default_value, bool *p_error)
bool | tds_parse_conf_section (const char *option, const char *value, void *param)
bool | tds_read_conf_file (TDSLOGIN *login, const char *server)
| Read configuration info for given server return 0 on error.
bool | 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 bool | tds_read_conf_sections (FILE *in, const char *server, TDSLOGIN *login)
TDSLOGIN * | 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 bool | tds_read_interfaces (const char *server, TDSLOGIN *login)
| Try to find the IP number and port for a (possibly) logical server name.
TDSRET | tds_set_interfaces_file_loc (const char *interf)
| Set the full name of interface file.
static bool | tds_try_conf_file (const tds_dir_char *path, const char *how, const char *server, TDSLOGIN *login)
static int | tds_vername_cmp (const void *key, const void *pelem)

## Variables
struct { |
unsigned char to_return |
char value [7] |
} | boolean_values []

## Detailed Description

Handle reading of configuration.

## Macro Definition Documentation

## ◆ TDS_FIND

#define TDS_FIND | ( |  | k,
|  |  | b,
|  |  | c )

Value:
tds_find(k, b, TDS_VECTOR_SIZE(b), sizeof(b[0]), c)

## Function Documentation

## ◆ parse_server_name_for_port()

bool parse_server_name_for_port | ( | TDSLOGIN * | connection,
|  | TDSLOGIN * | login,
|  | bool | update_server )
| static

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

Returns
  true when found, else false

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ search_interface_file()

bool search_interface_file | ( | TDSLOGIN * | login,
|  | const tds_dir_char * | dir,
|  | const tds_dir_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 'login'

Parameters

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

Returns
  false if not fount true if found

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ tds_config_verstr()

TDS_USMALLINT * tds_config_verstr | ( | const char * | tdsver,
|  | TDSLOGIN * | login )

Set TDS version from given string.

Parameters

  tdsver | tds string version
  login | where to store information

Returns
  as encoded hex value: high byte major, low byte minor.

Here is the caller graph for this function:

## ◆ tds_fix_login()

void tds_fix_login | ( | TDSLOGIN * | login | ) |

Fix configuration after reading it.

Currently this read some environment variables and replace some options.

Here is the caller graph for this function:

## ◆ tds_lookup_host()

struct addrinfo * tds_lookup_host | ( | const char * | servername | ) |

Get the IP address for a hostname.

Store server's IP address in the string 'ip' in dotted-decimal notation. (The "hostname" might itself be a dotted-decimal address.

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

## ◆ tds_lookup_port()

int tds_lookup_port | ( | const char * | portname | ) |
| static

Given a portname lookup the port.

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

Here is the caller graph for this function:

## ◆ tds_read_conf_file()

bool tds_read_conf_file | ( | TDSLOGIN * | login,
|  | const char * | server )

Read configuration info for given server return 0 on error.

Parameters

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

Here is the caller graph for this function:

## ◆ tds_read_conf_section()

bool 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

Here is the caller graph for this function:

## ◆ tds_read_config_info()

TDSLOGIN * 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.

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ tds_read_interfaces()

bool tds_read_interfaces | ( | const char * | server,
|  | TDSLOGIN * | login )
| 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.

Here is the call graph for this function:
Here is the caller graph for this function:

## ◆ tds_set_interfaces_file_loc()

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

Set the full name of interface file.

Parameters

  interf | file name

Here is the caller graph for this function:

## Variable Documentation

## ◆ [struct]

const struct { ... } boolean_values[]

Initial value:
= {
{ "yes", 1 },
{ "no", 0 },
{ "on", 1 },
{ "off", 0 },
{ "true", 1 },
{ "false", 0 }
}