ao_recv.h
Receiving

Notes

This module provides an abstraction for receiving from an opaque source.

Include

ao_async.h
ao_time.h
stdbool.h
stddef.h

Types

ao_recv_t

typedef struct ao_recv_t ao_recv_t;

Represents the receiving of data.

ao_recv_proc_t

typedef void (* ao_recv_proc_t)
(
    ao_recv_t * recv
);

Represents a function beginning or ending a receiving.

Structs

ao_recv_t

struct ao_recv_t
{
    ao_async_t      async;
    ao_recv_proc_t  begin;
    size_t volatile count;
    size_t          count_max;
    size_t          count_min;
    ao_recv_proc_t  end;
    void *          parameter;
    void *          ptr;
    bool   volatile result;
};
async The asynchronous event.
begin The function beginning the receiving.
count The number of received bytes.
count_max The maximum number of bytes to receive.
count_min The minimum number of bytes to receive.
end The function ending the receiving.
parameter An additional parameter.
ptr The location to store the received data.
result The result.

Functions

ao_recv

ao_recv_from

void ao_recv     (ao_recv_t * r, ao_time_t timeout);
void ao_recv_from(ao_recv_t * r, ao_time_t timeout, ao_time_t beginning);

Receives in a blocking fashion with a timeout and an optional beginning.

ao_recv_forever

void ao_recv_forever(ao_recv_t * r);

Receives indefinitely in a blocking fashion.

ao_recv_try

void ao_recv_try(ao_recv_t * r);

Receives in a non-blocking fashion.

ao_recv_begin

ao_recv_end

void ao_recv_begin(ao_recv_t * r);
void ao_recv_end  (ao_recv_t * r);

Begins or ends, respectively, a receiving.