/**\r
* @brief handle for a network connection\r
*/\r
-struct GNUNET_NETWORK_ConnectionHandle;\r
+struct GNUNET_CONNECTION_Handle;\r
\r
\r
/**\r
* 0 for sockets that need no write buffers, such as listen sockets)\r
* @return the boxed socket handle\r
*/\r
-struct GNUNET_NETWORK_ConnectionHandle\r
+struct GNUNET_CONNECTION_Handle\r
*GNUNET_CONNECTION_create_from_existing (struct\r
GNUNET_SCHEDULER_Handle\r
*sched,\r
* 0 for sockets that need no write buffers, such as listen sockets)\r
* @return the socket handle, NULL on error (for example, access refused)\r
*/\r
-struct GNUNET_NETWORK_ConnectionHandle\r
+struct GNUNET_CONNECTION_Handle\r
*GNUNET_CONNECTION_create_from_accept (struct\r
GNUNET_SCHEDULER_Handle\r
*sched,\r
* 0 for sockets that need no write buffers, such as listen sockets)\r
* @return the socket handle\r
*/\r
-struct GNUNET_NETWORK_ConnectionHandle\r
+struct GNUNET_CONNECTION_Handle\r
*GNUNET_CONNECTION_create_from_connect (struct\r
GNUNET_SCHEDULER_Handle\r
*sched,\r
* 0 for sockets that need no write buffers, such as listen sockets)\r
* @return the socket handle\r
*/\r
-struct GNUNET_NETWORK_ConnectionHandle\r
+struct GNUNET_CONNECTION_Handle\r
*GNUNET_CONNECTION_create_from_sockaddr (struct\r
GNUNET_SCHEDULER_Handle\r
*sched, int af_family,\r
* @param sock socket to check\r
* @return GNUNET_YES if valid, GNUNET_NO otherwise\r
*/\r
-int GNUNET_CONNECTION_check (struct GNUNET_NETWORK_ConnectionHandle\r
+int GNUNET_CONNECTION_check (struct GNUNET_CONNECTION_Handle\r
*sock);\r
\r
\r
* @return GNUNET_OK on success\r
*/\r
int GNUNET_CONNECTION_get_address (struct\r
- GNUNET_NETWORK_ConnectionHandle\r
+ GNUNET_CONNECTION_Handle\r
*sock, void **addr,\r
size_t * addrlen);\r
\r
*\r
* @param sock socket to destroy\r
*/\r
-void GNUNET_CONNECTION_destroy (struct GNUNET_NETWORK_ConnectionHandle\r
+void GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle\r
*sock);\r
\r
\r
* @return scheduler task ID used for receiving, GNUNET_SCHEDULER_NO_TASK on error\r
*/\r
GNUNET_SCHEDULER_TaskIdentifier\r
-GNUNET_CONNECTION_receive (struct GNUNET_NETWORK_ConnectionHandle\r
+GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle\r
*sock, size_t max,\r
struct GNUNET_TIME_Relative timeout,\r
GNUNET_NETWORK_Receiver receiver,\r
* @return closure of the original receiver callback\r
*/\r
void *GNUNET_CONNECTION_receive_cancel (struct\r
- GNUNET_NETWORK_ConnectionHandle\r
+ GNUNET_CONNECTION_Handle\r
*sock,\r
GNUNET_SCHEDULER_TaskIdentifier\r
task);\r
*/\r
struct GNUNET_NETWORK_TransmitHandle\r
*GNUNET_CONNECTION_notify_transmit_ready (struct\r
- GNUNET_NETWORK_ConnectionHandle\r
+ GNUNET_CONNECTION_Handle\r
*sock, size_t size,\r
struct\r
GNUNET_TIME_Relative\r
/**
* Our socket handle.
*/
- struct GNUNET_NETWORK_ConnectionHandle *sh;
+ struct GNUNET_CONNECTION_Handle *sh;
/**
* Timeout for receiving (in absolute time).
/**
* @brief handle for a network socket
*/
-struct GNUNET_NETWORK_ConnectionHandle
+struct GNUNET_CONNECTION_Handle
{
/**
* 0 for sockets that need no write buffers, such as listen sockets)
* @return the boxed socket handle
*/
-struct GNUNET_NETWORK_ConnectionHandle *
+struct GNUNET_CONNECTION_Handle *
GNUNET_CONNECTION_create_from_existing (struct GNUNET_SCHEDULER_Handle
*sched, struct GNUNET_NETWORK_Descriptor *osSocket,
size_t maxbuf)
{
- struct GNUNET_NETWORK_ConnectionHandle *ret;
- ret = GNUNET_malloc (sizeof (struct GNUNET_NETWORK_ConnectionHandle) + maxbuf);
+ struct GNUNET_CONNECTION_Handle *ret;
+ ret = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle) + maxbuf);
ret->write_buffer = (char *) &ret[1];
ret->write_buffer_size = maxbuf;
ret->sock = osSocket;
* 0 for sockets that need no write buffers, such as listen sockets)
* @return the socket handle, NULL on error
*/
-struct GNUNET_NETWORK_ConnectionHandle *
+struct GNUNET_CONNECTION_Handle *
GNUNET_CONNECTION_create_from_accept (struct GNUNET_SCHEDULER_Handle
*sched,
GNUNET_NETWORK_AccessCheck access,
void *access_cls, struct GNUNET_NETWORK_Descriptor *lsock,
size_t maxbuf)
{
- struct GNUNET_NETWORK_ConnectionHandle *ret;
+ struct GNUNET_CONNECTION_Handle *ret;
char addr[32];
socklen_t addrlen;
struct GNUNET_NETWORK_Descriptor *sock;
_("Accepting connection from `%s'\n"),
GNUNET_a2s(uaddr, addrlen));
#endif
- ret = GNUNET_malloc (sizeof (struct GNUNET_NETWORK_ConnectionHandle) + maxbuf);
+ ret = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle) + maxbuf);
ret->write_buffer = (char *) &ret[1];
ret->write_buffer_size = maxbuf;
ret->addr = uaddr;
* @return GNUNET_OK on success
*/
int
-GNUNET_CONNECTION_get_address (struct GNUNET_NETWORK_ConnectionHandle *sock,
+GNUNET_CONNECTION_get_address (struct GNUNET_CONNECTION_Handle *sock,
void **addr, size_t * addrlen)
{
if ((sock->addr == NULL) || (sock->addrlen == 0))
* families as specified in the "address_families" array.
*/
static void
-try_lookup (struct GNUNET_NETWORK_ConnectionHandle *sock)
+try_lookup (struct GNUNET_CONNECTION_Handle *sock)
{
struct addrinfo hints;
int ec;
* @return GNUNET_SYSERR error (no more addresses to try)
*/
static int
-try_connect (struct GNUNET_NETWORK_ConnectionHandle *sock)
+try_connect (struct GNUNET_CONNECTION_Handle *sock)
{
struct GNUNET_NETWORK_Descriptor *s;
connect_continuation (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct GNUNET_NETWORK_ConnectionHandle *sock = cls;
+ struct GNUNET_CONNECTION_Handle *sock = cls;
unsigned int len;
int error;
* 0 for sockets that need no write buffers, such as listen sockets)
* @return the socket handle
*/
-struct GNUNET_NETWORK_ConnectionHandle *
+struct GNUNET_CONNECTION_Handle *
GNUNET_CONNECTION_create_from_connect (struct GNUNET_SCHEDULER_Handle
*sched, const char *hostname,
uint16_t port, size_t maxbuf)
{
- struct GNUNET_NETWORK_ConnectionHandle *ret;
+ struct GNUNET_CONNECTION_Handle *ret;
- ret = GNUNET_malloc (sizeof (struct GNUNET_NETWORK_ConnectionHandle) + maxbuf);
+ ret = GNUNET_malloc (sizeof (struct GNUNET_CONNECTION_Handle) + maxbuf);
ret->sock = NULL;
ret->sched = sched;
ret->write_buffer = (char *) &ret[1];
* 0 for sockets that need no write buffers, such as listen sockets)
* @return the socket handle
*/
-struct GNUNET_NETWORK_ConnectionHandle *
+struct GNUNET_CONNECTION_Handle *
GNUNET_CONNECTION_create_from_sockaddr (struct GNUNET_SCHEDULER_Handle
*sched, int af_family,
const struct sockaddr *serv_addr,
socklen_t addrlen, size_t maxbuf)
{
struct GNUNET_NETWORK_Descriptor *s;
- struct GNUNET_NETWORK_ConnectionHandle *ret;
+ struct GNUNET_CONNECTION_Handle *ret;
s = GNUNET_NETWORK_socket_socket (af_family, SOCK_STREAM, 0);
if (s == NULL)
* @return GNUNET_YES if valid, GNUNET_NO otherwise
*/
int
-GNUNET_CONNECTION_check (struct GNUNET_NETWORK_ConnectionHandle *sock)
+GNUNET_CONNECTION_check (struct GNUNET_CONNECTION_Handle *sock)
{
if (sock->ai != NULL)
return GNUNET_YES; /* still trying to connect */
destroy_continuation (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct GNUNET_NETWORK_ConnectionHandle *sock = cls;
+ struct GNUNET_CONNECTION_Handle *sock = cls;
GNUNET_NETWORK_TransmitReadyNotify notify;
if (sock->write_task != GNUNET_SCHEDULER_NO_TASK)
* @param sock socket to destroy
*/
void
-GNUNET_CONNECTION_destroy (struct GNUNET_NETWORK_ConnectionHandle *sock)
+GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *sock)
{
if (sock->write_buffer_off == 0)
sock->ai_pos = NULL; /* if we're still trying to connect and have
* Tell the receiver callback that a timeout was reached.
*/
static void
-signal_timeout (struct GNUNET_NETWORK_ConnectionHandle *sh)
+signal_timeout (struct GNUNET_CONNECTION_Handle *sh)
{
GNUNET_NETWORK_Receiver receiver;
* Tell the receiver callback that we had an IO error.
*/
static void
-signal_error (struct GNUNET_NETWORK_ConnectionHandle *sh, int errcode)
+signal_error (struct GNUNET_CONNECTION_Handle *sh, int errcode)
{
GNUNET_NETWORK_Receiver receiver;
GNUNET_assert (NULL != (receiver = sh->receiver));
static void
receive_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct GNUNET_NETWORK_ConnectionHandle *sh = cls;
+ struct GNUNET_CONNECTION_Handle *sh = cls;
struct GNUNET_TIME_Absolute now;
char buffer[sh->max];
ssize_t ret;
static void
receive_again (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct GNUNET_NETWORK_ConnectionHandle *sh = cls;
+ struct GNUNET_CONNECTION_Handle *sh = cls;
struct GNUNET_TIME_Absolute now;
sh->read_task = GNUNET_SCHEDULER_NO_TASK;
* @return scheduler task ID used for receiving, GNUNET_SCHEDULER_NO_TASK on error
*/
GNUNET_SCHEDULER_TaskIdentifier
-GNUNET_CONNECTION_receive (struct GNUNET_NETWORK_ConnectionHandle *sock,
+GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle *sock,
size_t max,
struct GNUNET_TIME_Relative timeout,
GNUNET_NETWORK_Receiver receiver, void *receiver_cls)
* @return closure of the original receiver callback
*/
void *
-GNUNET_CONNECTION_receive_cancel (struct GNUNET_NETWORK_ConnectionHandle *sock,
+GNUNET_CONNECTION_receive_cancel (struct GNUNET_CONNECTION_Handle *sock,
GNUNET_SCHEDULER_TaskIdentifier task)
{
GNUNET_assert (sock->read_task == task);
* @return GNUNET_YES if we were able to call notify
*/
static int
-process_notify (struct GNUNET_NETWORK_ConnectionHandle *sock)
+process_notify (struct GNUNET_CONNECTION_Handle *sock)
{
size_t used;
size_t avail;
static void
transmit_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct GNUNET_NETWORK_ConnectionHandle *sock = cls;
+ struct GNUNET_CONNECTION_Handle *sock = cls;
GNUNET_NETWORK_TransmitReadyNotify notify;
#if DEBUG_NETWORK
static void
-transmit_error (struct GNUNET_NETWORK_ConnectionHandle *sock)
+transmit_error (struct GNUNET_CONNECTION_Handle *sock)
{
if (sock->nth.notify_ready == NULL)
return; /* nobody to tell about it */
static void
transmit_ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct GNUNET_NETWORK_ConnectionHandle *sock = cls;
+ struct GNUNET_CONNECTION_Handle *sock = cls;
ssize_t ret;
size_t have;
* NULL if we are already going to notify someone else (busy)
*/
struct GNUNET_NETWORK_TransmitHandle *
-GNUNET_CONNECTION_notify_transmit_ready (struct GNUNET_NETWORK_ConnectionHandle
+GNUNET_CONNECTION_notify_transmit_ready (struct GNUNET_CONNECTION_Handle
*sock, size_t size,
struct GNUNET_TIME_Relative timeout,
GNUNET_NETWORK_TransmitReadyNotify