aboutsummaryrefslogtreecommitdiffstats
path: root/libglouglou/sendbuf.h
blob: 340e1c754417f07fd980f71dfe43f9f8f913c829 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <event.h>
#include <sys/queue.h>

struct sendbuf {
  struct event_base *ev_base;
  struct event *ev_timer;
  struct timeval ev_timer_tv;
  int   sndbuf_max;
  int   msec_max;
};

struct sendbuf_queue {
  void *buffer;
  int   buffer_size;
  int   buffer_pos;
  int (*send_func)(void *, int, void *);
  void *usrdata;
  int   flushing;
  int   flushed_len;
}

struct sendbuf *sendbuf_init(struct event_base *, int, int, int);
void            sendbuf_shutdown(struct sendbuf *);
void            sendbuf_queue_add(struct sendbuf *,
                                  int (*send_func)(void *, int, void *),
                                  void *);
void           *sendbuf_token_get(struct sendbuf *, int);
void            sendbuf_token_ready(struct sendbuf *, void *);