/**
* Handle for our current transmission request.
*/
- struct GNUNET_NETWORK_TransmitHandle *th;
+ struct GNUNET_CONNECTION_TransmitHandle *th;
/**
* Head of doubly-linked list of pending requests.
* The function will be called with a NULL buffer to signal
* timeout.
*/
- GNUNET_NETWORK_TransmitReadyNotify get_message;
+ GNUNET_CONNECTION_TransmitReadyNotify get_message;
/**
* Closure for get_message.
* If this entry is for a transmission request, pointer
* to the notify callback; otherwise NULL.
*/
- GNUNET_NETWORK_TransmitReadyNotify notify;
+ GNUNET_CONNECTION_TransmitReadyNotify notify;
/**
* Closure for notify.
struct GNUNET_CORE_Handle *h;
struct SendMessage *sm;
size_t dt;
- GNUNET_NETWORK_TransmitReadyNotify notify;
+ GNUNET_CONNECTION_TransmitReadyNotify notify;
void *notify_cls;
h = th->ch;
struct GNUNET_TIME_Relative maxdelay,
const struct GNUNET_PeerIdentity *target,
size_t notify_size,
- GNUNET_NETWORK_TransmitReadyNotify notify,
+ GNUNET_CONNECTION_TransmitReadyNotify notify,
void *notify_cls)
{
struct GNUNET_CORE_TransmitHandle *th;
* Current transmit handle, NULL if no transmission request
* is pending.
*/
- struct GNUNET_NETWORK_TransmitHandle *th;
+ struct GNUNET_CONNECTION_TransmitHandle *th;
/**
* Array of the types of messages this peer cares
* non-NULL if the notify callback was queued (can be used to cancel
* using GNUNET_CONNECTION_notify_transmit_ready_cancel)
*/
-struct GNUNET_NETWORK_TransmitHandle
+struct GNUNET_CONNECTION_TransmitHandle
*GNUNET_CLIENT_notify_transmit_ready (struct GNUNET_CLIENT_Connection *sock,
size_t size,
struct GNUNET_TIME_Relative timeout,
- GNUNET_NETWORK_TransmitReadyNotify
+ GNUNET_CONNECTION_TransmitReadyNotify
notify, void *notify_cls);
* Timeout we use on TCP connect before trying another\r
* result from the DNS resolver. 5s.\r
*/\r
-#define GNUNET_NETWORK_CONNECT_RETRY_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)\r
+#define GNUNET_CONNECTION_CONNECT_RETRY_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)\r
\r
/**\r
* @brief handle for a network connection\r
* @return GNUNET_YES to allow, GNUNET_NO to deny, GNUNET_SYSERR\r
* for unknown address family (will be denied).\r
*/\r
-typedef int (*GNUNET_NETWORK_AccessCheck) (void *cls,\r
+typedef int (*GNUNET_CONNECTION_AccessCheck) (void *cls,\r
const struct sockaddr * addr,\r
socklen_t addrlen);\r
\r
* @param addrlen size of addr\r
* @param errCode value of errno (on errors receiving)\r
*/\r
-typedef void (*GNUNET_NETWORK_Receiver) (void *cls,\r
+typedef void (*GNUNET_CONNECTION_Receiver) (void *cls,\r
const void *buf,\r
size_t available,\r
const struct sockaddr * addr,\r
*GNUNET_CONNECTION_create_from_accept (struct\r
GNUNET_SCHEDULER_Handle\r
*sched,\r
- GNUNET_NETWORK_AccessCheck\r
+ GNUNET_CONNECTION_AccessCheck\r
access, void *access_cls,\r
struct\r
GNUNET_NETWORK_Descriptor\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
+ GNUNET_CONNECTION_Receiver receiver,\r
void *receiver_cls);\r
\r
\r
* @param buf where the callee should write the message\r
* @return number of bytes written to buf\r
*/\r
-typedef size_t (*GNUNET_NETWORK_TransmitReadyNotify) (void *cls,\r
+typedef size_t (*GNUNET_CONNECTION_TransmitReadyNotify) (void *cls,\r
size_t size, void *buf);\r
\r
\r
* Opaque handle that can be used to cancel\r
* a transmit-ready notification.\r
*/\r
-struct GNUNET_NETWORK_TransmitHandle;\r
+struct GNUNET_CONNECTION_TransmitHandle;\r
\r
/**\r
* Ask the socket to call us once the specified number of bytes\r
* @return non-NULL if the notify callback was queued,\r
* NULL if we are already going to notify someone else (busy)\r
*/\r
-struct GNUNET_NETWORK_TransmitHandle\r
+struct GNUNET_CONNECTION_TransmitHandle\r
*GNUNET_CONNECTION_notify_transmit_ready (struct\r
GNUNET_CONNECTION_Handle\r
*sock, size_t size,\r
struct\r
GNUNET_TIME_Relative\r
timeout,\r
- GNUNET_NETWORK_TransmitReadyNotify\r
+ GNUNET_CONNECTION_TransmitReadyNotify\r
notify, void *notify_cls);\r
\r
\r
*/\r
void\r
GNUNET_CONNECTION_notify_transmit_ready_cancel (struct\r
- GNUNET_NETWORK_TransmitHandle\r
+ GNUNET_CONNECTION_TransmitHandle\r
*h);\r
\r
\r
*target,
size_t
notify_size,
- GNUNET_NETWORK_TransmitReadyNotify
+ GNUNET_CONNECTION_TransmitReadyNotify
notify,
void
*notify_cls);
struct GNUNET_SERVER_Handle *GNUNET_SERVER_create (struct
GNUNET_SCHEDULER_Handle
*sched,
- GNUNET_NETWORK_AccessCheck
+ GNUNET_CONNECTION_AccessCheck
access, void *access_cls,
const struct sockaddr
*serverAddr,
* GNUNET_CONNECTION_notify_transmit_ready_cancel.
* NULL if we are already going to notify someone else (busy)
*/
-struct GNUNET_NETWORK_TransmitHandle
+struct GNUNET_CONNECTION_TransmitHandle
*GNUNET_SERVER_notify_transmit_ready (struct GNUNET_SERVER_Client *client,
size_t size,
struct GNUNET_TIME_Relative timeout,
- GNUNET_NETWORK_TransmitReadyNotify
+ GNUNET_CONNECTION_TransmitReadyNotify
callback, void *callback_cls);
(*GNUNET_SERVER_ReceiveCallback) (void *cls,
size_t max,
struct GNUNET_TIME_Relative timeout,
- GNUNET_NETWORK_Receiver
+ GNUNET_CONNECTION_Receiver
receiver, void *receiver_cls);
struct
GNUNET_TIME_Relative
timeout,
- GNUNET_NETWORK_TransmitReadyNotify
+ GNUNET_CONNECTION_TransmitReadyNotify
notify,
void *notify_cls);
unsigned int priority,
struct GNUNET_TIME_Relative
timeout,
- GNUNET_NETWORK_TransmitReadyNotify
+ GNUNET_CONNECTION_TransmitReadyNotify
notify, void *notify_cls);
uint16_t msize;
size_t tsize;
const struct GNUNET_MessageHeader *msg;
- struct GNUNET_NETWORK_TransmitHandle *th;
+ struct GNUNET_CONNECTION_TransmitHandle *th;
char *cbuf;
if (buf == NULL)
{
struct ClientMessageQueueEntry *q;
uint16_t msize;
- struct GNUNET_NETWORK_TransmitHandle *th;
+ struct GNUNET_CONNECTION_TransmitHandle *th;
if ((client->message_count >= MAX_PENDING) && (GNUNET_YES == may_drop))
{
/**
* Handle for pending transmission request.
*/
- struct GNUNET_NETWORK_TransmitHandle *transmit_handle;
+ struct GNUNET_CONNECTION_TransmitHandle *transmit_handle;
/**
* To whom are we talking to (set to our identity
* Function to call when notify_size bytes are available
* for transmission.
*/
- GNUNET_NETWORK_TransmitReadyNotify notify;
+ GNUNET_CONNECTION_TransmitReadyNotify notify;
/**
* Closure for notify.
/**
* Handle to our registration with the client for notification.
*/
- struct GNUNET_NETWORK_TransmitHandle *network_handle;
+ struct GNUNET_CONNECTION_TransmitHandle *network_handle;
/**
* Linked list of transmit handles that are waiting for the
size_t size,
int at_head,
struct GNUNET_TIME_Relative timeout,
- GNUNET_NETWORK_TransmitReadyNotify notify,
+ GNUNET_CONNECTION_TransmitReadyNotify notify,
void *notify_cls)
{
struct GNUNET_TRANSPORT_TransmitHandle *th;
struct ClientTransmitWrapper
{
- GNUNET_NETWORK_TransmitReadyNotify notify;
+ GNUNET_CONNECTION_TransmitReadyNotify notify;
void *notify_cls;
struct GNUNET_TRANSPORT_TransmitHandle *th;
};
*target, size_t size,
unsigned int priority,
struct GNUNET_TIME_Relative timeout,
- GNUNET_NETWORK_TransmitReadyNotify
+ GNUNET_CONNECTION_TransmitReadyNotify
notify, void *notify_cls)
{
struct GNUNET_TRANSPORT_TransmitHandle *pos;
* @return NULL if our buffer will never hold size bytes,
* a handle if the notify callback was queued (can be used to cancel)
*/
-struct GNUNET_NETWORK_TransmitHandle *
+struct GNUNET_CONNECTION_TransmitHandle *
GNUNET_CLIENT_notify_transmit_ready (struct GNUNET_CLIENT_Connection *sock,
size_t size,
struct GNUNET_TIME_Relative timeout,
- GNUNET_NETWORK_TransmitReadyNotify
+ GNUNET_CONNECTION_TransmitReadyNotify
notify, void *notify_cls)
{
return GNUNET_CONNECTION_notify_transmit_ready (sock->sock,
static int address_families[] =
{ AF_INET, AF_INET6, AF_UNSPEC };
-struct GNUNET_NETWORK_TransmitHandle
+struct GNUNET_CONNECTION_TransmitHandle
{
/**
* Function to call if the send buffer has notify_size
* bytes available.
*/
- GNUNET_NETWORK_TransmitReadyNotify notify_ready;
+ GNUNET_CONNECTION_TransmitReadyNotify notify_ready;
/**
* Closure for notify_ready.
/**
* The handle we return for GNUNET_CONNECTION_notify_transmit_ready.
*/
- struct GNUNET_NETWORK_TransmitHandle nth;
+ struct GNUNET_CONNECTION_TransmitHandle nth;
/**
* Underlying OS's socket, set to NULL after fatal errors.
* Function to call on data received, NULL
* if no receive is pending.
*/
- GNUNET_NETWORK_Receiver receiver;
+ GNUNET_CONNECTION_Receiver receiver;
/**
* Closure for receiver.
struct GNUNET_CONNECTION_Handle *
GNUNET_CONNECTION_create_from_accept (struct GNUNET_SCHEDULER_Handle
*sched,
- GNUNET_NETWORK_AccessCheck access,
+ GNUNET_CONNECTION_AccessCheck access,
void *access_cls, struct GNUNET_NETWORK_Descriptor *lsock,
size_t maxbuf)
{
sock->connect_task = GNUNET_SCHEDULER_add_write_net (tc->sched, GNUNET_NO, /* abort on shutdown */
GNUNET_SCHEDULER_PRIORITY_KEEP,
GNUNET_SCHEDULER_NO_TASK,
- GNUNET_NETWORK_CONNECT_RETRY_TIMEOUT,
+ GNUNET_CONNECTION_CONNECT_RETRY_TIMEOUT,
sock->sock,
&connect_continuation,
sock);
ret->connect_task = GNUNET_SCHEDULER_add_write_net (sched, GNUNET_NO, /* abort on shutdown */
GNUNET_SCHEDULER_PRIORITY_KEEP,
GNUNET_SCHEDULER_NO_TASK,
- GNUNET_NETWORK_CONNECT_RETRY_TIMEOUT,
+ GNUNET_CONNECTION_CONNECT_RETRY_TIMEOUT,
ret->sock,
&connect_continuation, ret);
return ret;
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct GNUNET_CONNECTION_Handle *sock = cls;
- GNUNET_NETWORK_TransmitReadyNotify notify;
+ GNUNET_CONNECTION_TransmitReadyNotify notify;
if (sock->write_task != GNUNET_SCHEDULER_NO_TASK)
{
static void
signal_timeout (struct GNUNET_CONNECTION_Handle *sh)
{
- GNUNET_NETWORK_Receiver receiver;
+ GNUNET_CONNECTION_Receiver receiver;
#if DEBUG_NETWORK
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
static void
signal_error (struct GNUNET_CONNECTION_Handle *sh, int errcode)
{
- GNUNET_NETWORK_Receiver receiver;
+ GNUNET_CONNECTION_Receiver receiver;
GNUNET_assert (NULL != (receiver = sh->receiver));
sh->receiver = NULL;
receiver (sh->receiver_cls, NULL, 0, sh->addr, sh->addrlen, errcode);
struct GNUNET_TIME_Absolute now;
char buffer[sh->max];
ssize_t ret;
- GNUNET_NETWORK_Receiver receiver;
+ GNUNET_CONNECTION_Receiver receiver;
sh->read_task = GNUNET_SCHEDULER_NO_TASK;
now = GNUNET_TIME_absolute_get ();
GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle *sock,
size_t max,
struct GNUNET_TIME_Relative timeout,
- GNUNET_NETWORK_Receiver receiver, void *receiver_cls)
+ GNUNET_CONNECTION_Receiver receiver, void *receiver_cls)
{
struct GNUNET_SCHEDULER_TaskContext tc;
size_t used;
size_t avail;
size_t size;
- GNUNET_NETWORK_TransmitReadyNotify notify;
+ GNUNET_CONNECTION_TransmitReadyNotify notify;
GNUNET_assert (sock->write_task == GNUNET_SCHEDULER_NO_TASK);
if (NULL == (notify = sock->nth.notify_ready))
transmit_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct GNUNET_CONNECTION_Handle *sock = cls;
- GNUNET_NETWORK_TransmitReadyNotify notify;
+ GNUNET_CONNECTION_TransmitReadyNotify notify;
#if DEBUG_NETWORK
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmit fails, time out reached.\n");
* @return non-NULL if the notify callback was queued,
* NULL if we are already going to notify someone else (busy)
*/
-struct GNUNET_NETWORK_TransmitHandle *
+struct GNUNET_CONNECTION_TransmitHandle *
GNUNET_CONNECTION_notify_transmit_ready (struct GNUNET_CONNECTION_Handle
*sock, size_t size,
struct GNUNET_TIME_Relative timeout,
- GNUNET_NETWORK_TransmitReadyNotify
+ GNUNET_CONNECTION_TransmitReadyNotify
notify, void *notify_cls)
{
if (sock->nth.notify_ready != NULL)
*/
void
GNUNET_CONNECTION_notify_transmit_ready_cancel (struct
- GNUNET_NETWORK_TransmitHandle *h)
+ GNUNET_CONNECTION_TransmitHandle *h)
{
GNUNET_assert (h->notify_ready != NULL);
GNUNET_SCHEDULER_cancel (h->sh->sched, h->timeout_task);
/**
* Function to call for access control.
*/
- GNUNET_NETWORK_AccessCheck access;
+ GNUNET_CONNECTION_AccessCheck access;
/**
* Closure for access.
*/
struct GNUNET_SERVER_Handle *
GNUNET_SERVER_create (struct GNUNET_SCHEDULER_Handle *sched,
- GNUNET_NETWORK_AccessCheck access,
+ GNUNET_CONNECTION_AccessCheck access,
void *access_cls,
const struct sockaddr *serverAddr,
socklen_t socklen,
sock_receive (void *cls,
size_t max,
struct GNUNET_TIME_Relative timeout,
- GNUNET_NETWORK_Receiver receiver, void *receiver_cls)
+ GNUNET_CONNECTION_Receiver receiver, void *receiver_cls)
{
return GNUNET_CONNECTION_receive (cls, max, timeout, receiver, receiver_cls);
}
sock_notify_transmit_ready (void *cls,
size_t size,
struct GNUNET_TIME_Relative timeout,
- GNUNET_NETWORK_TransmitReadyNotify notify,
+ GNUNET_CONNECTION_TransmitReadyNotify notify,
void *notify_cls)
{
return GNUNET_CONNECTION_notify_transmit_ready (cls, size, timeout, notify,
* GNUNET_CONNECTION_notify_transmit_ready_cancel.
* NULL if we are already going to notify someone else (busy)
*/
-struct GNUNET_NETWORK_TransmitHandle *
+struct GNUNET_CONNECTION_TransmitHandle *
GNUNET_SERVER_notify_transmit_ready (struct GNUNET_SERVER_Client *client,
size_t size,
struct GNUNET_TIME_Relative timeout,
- GNUNET_NETWORK_TransmitReadyNotify
+ GNUNET_CONNECTION_TransmitReadyNotify
callback, void *callback_cls)
{
return client->notify_transmit_ready (client->client_closure,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
int *ok = cls;
- struct GNUNET_NETWORK_TransmitHandle *th;
+ struct GNUNET_CONNECTION_TransmitHandle *th;
struct GNUNET_CONNECTION_Handle *csock;
csock = GNUNET_CONNECTION_create_from_connect (tc->sched,
struct SignalTimeoutContext
{
- GNUNET_NETWORK_Receiver cb;
+ GNUNET_CONNECTION_Receiver cb;
void *cb_cls;
};
my_receive (void *cls,
size_t max,
struct GNUNET_TIME_Relative timeout,
- GNUNET_NETWORK_Receiver receiver, void *receiver_cls)
+ GNUNET_CONNECTION_Receiver receiver, void *receiver_cls)
{
int *ok = cls;
struct GNUNET_MessageHeader msg;
my_transmit_ready_cb (void *cls,
size_t size,
struct GNUNET_TIME_Relative timeout,
- GNUNET_NETWORK_TransmitReadyNotify notify,
+ GNUNET_CONNECTION_TransmitReadyNotify notify,
void *notify_cls)
{
static int non_null_addr;