2
* Drizzle Client & Protocol Library
4
* Copyright (C) 2008 Eric Day (eday@oddments.org)
7
* Use and distribution licensed under the BSD license. See
8
* the COPYING file in this directory for full text.
13
* @brief Connection Definitions for Unix Domain Sockets
18
const char *drizzle_con_uds(const drizzle_con_st *con)
20
if (con->socket_type == DRIZZLE_CON_SOCKET_UDS)
22
if (con->socket.uds.sockaddr.sun_path[0] != 0)
23
return con->socket.uds.sockaddr.sun_path;
25
if (con->options & DRIZZLE_CON_MYSQL)
26
return DRIZZLE_DEFAULT_UDS_MYSQL;
28
return DRIZZLE_DEFAULT_UDS;
34
void drizzle_con_set_uds(drizzle_con_st *con, const char *uds)
36
drizzle_con_reset_addrinfo(con);
38
con->socket_type= DRIZZLE_CON_SOCKET_UDS;
43
con->socket.uds.sockaddr.sun_family= AF_UNIX;
44
strncpy(con->socket.uds.sockaddr.sun_path, uds,
45
sizeof(con->socket.uds.sockaddr.sun_path));
46
con->socket.uds.sockaddr.sun_path[sizeof(con->socket.uds.sockaddr.sun_path) - 1]= 0;
48
con->socket.uds.addrinfo.ai_family= AF_UNIX;
49
con->socket.uds.addrinfo.ai_socktype= SOCK_STREAM;
50
con->socket.uds.addrinfo.ai_protocol= 0;
51
con->socket.uds.addrinfo.ai_addrlen= sizeof(struct sockaddr_un);
52
con->socket.uds.addrinfo.ai_addr= (struct sockaddr *)&(con->socket.uds.sockaddr);