#include "ks_bquery.h"
#include "ks_response.h"
#include <sys/types.h>
#include <sys/socket.h>
Go to the source code of this file.
Defines | |
| #define | KS_TIMEOUT_DEFAULT 1000 |
Typedefs | |
| typedef _ks_socket_t | ks_socket_t |
| libkarmaclient socket type. | |
Functions | |
| ks_socket_t * | ks_socket_new (const char *, const char *, int) |
| int | ks_socket_connect (ks_socket_t *) |
| void | ks_socket_close (ks_socket_t *) |
| ssize_t | ks_socket_send (ks_socket_t *, ks_bquery_t *) |
| ks_response_t * | ks_socket_recv (ks_socket_t *, ks_string_t *, int) |
| ks_response_t * | ks_socket_ask (ks_socket_t *, ks_bquery_t *, int) |
| void | ks_socket_free (ks_socket_t *) |
| void | ks_socket_set_auth (ks_socket_t *, const char *, const char *) |
Type and function declarations for the functions defined in ks_socket_posix.c. Do not include this file directly in your client. Instead, include the application header file, ks.h, which will include all the libkarmaclient header files for you.
Definition in file ks_socket.h.
|
|
The default query timeout, in milliseconds. Definition at line 65 of file ks_socket.h. Referenced by ks_socket_ask(), and ks_socket_recv(). |
|
|
libkarmaclient socket type.
Definition at line 53 of file ks_socket.h. |
|
||||||||||||||||
|
A threadsafe implementation to retrieve a response to a specific query from the socket. It is important that the value returned by this function is tested for failure, as other functions that take the ks_response_t pointer as an argument will not test that it is not NULL before trying to dereference it. This method makes at most 3 retries, doubling the timeout each time.
Definition at line 734 of file ks_socket_posix.c. References ks_bquery_id_get(), ks_socket_recv(), ks_socket_send(), and KS_TIMEOUT_DEFAULT. Referenced by main(). |
|
|
Close a connected socket, if it is connected.
Definition at line 390 of file ks_socket_posix.c. References _ks_socket_t::socket. Referenced by ks_socket_connect(), ks_socket_free(), and ks_socket_send(). |
|
|
Connect a ks_socket_t. This looks up the hostname and port to connect to, and connects a new socket to the address.
Definition at line 351 of file ks_socket_posix.c. References _ks_socket_t::addr, ks_error(), ks_socket_close(), _ks_socket_t::proto, and _ks_socket_t::socket. Referenced by ks_socket_send(), and main(). |
|
|
Destroy a given ks_socket_t, close it if it's open and free any associated allocated memory.
Definition at line 322 of file ks_socket_posix.c. References _ks_socket_t::c_cache, _ks_socket_t::cache, _ks_socket_t::creds, _ks_socket_t::hostname, ks_array_fini(), ks_free(), ks_socket_close(), _ks_socket_t::m_cache, _ks_socket_t::m_recv, _ks_socket_t::m_send, _ks_socket_t::port, and _ks_socket_t::princ. Referenced by main(). |
|
||||||||||||||||
|
Create a new ks_socket_t to connect to hostname:port using proto.
Definition at line 275 of file ks_socket_posix.c. References _ks_socket_t::c_cache, _ks_socket_t::cache, _ks_socket_t::creds, _ks_socket_t::hostname, ks_array_init(), ks_error(), ks_malloc(), KS_SLAVE_HOST_DEFAULT, KS_SLAVE_PORT_DEFAULT, _ks_socket_t::m_cache, _ks_socket_t::m_recv, _ks_socket_t::m_send, _ks_socket_t::port, _ks_socket_t::princ, _ks_socket_t::proto, and _ks_socket_t::socket. Referenced by main(). |
|
||||||||||||||||
|
A threadsafe implementation to retrieve a response with a specific id from the socket.
Definition at line 648 of file ks_socket_posix.c. References _ks_socket_t::c_cache, ks_error(), ks_response_id(), ks_string_equals(), KS_TIMEOUT_DEFAULT, _ks_socket_t::m_cache, _ks_socket_t::m_recv, MSECS, NSECS, and USECS. Referenced by ks_socket_ask(). |
|
||||||||||||
|
Send ks_bquery_t (q) over ks_socket_t (k).
Definition at line 424 of file ks_socket_posix.c. References _ks_socket_t::creds, ks_bquery_has_auth(), ks_bquery_packet(), ks_bquery_set_auth(), ks_error(), ks_free(), ks_malloc(), ks_socket_close(), ks_socket_connect(), ks_string_free(), ks_string_get(), ks_string_length(), _ks_socket_t::m_send, _ks_socket_t::princ, _ks_socket_t::proto, and _ks_socket_t::socket. Referenced by ks_socket_ask(). |
|
||||||||||||||||
|
Definition at line 141 of file ks_socket_posix.c. References _ks_socket_t::creds, ks_free(), ks_malloc(), and _ks_socket_t::princ. Referenced by main(). |
1.4.4