summaryrefslogtreecommitdiff
path: root/src/include/skalibs/unixconnection.h
blob: c54a3118540e345b2aeb7ccef936eabfbb3663e8 (plain)
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
 /* ISC license. */

#ifndef UNIXCONNECTION_H
#define UNIXCONNECTION_H

#include <skalibs/unixmessage.h>

typedef struct unixconnection_s unixconnection_t, *unixconnection_t_ref ;
struct unixconnection_s
{
  unixmessage_sender_t out ;
  unixmessage_receiver_t in ;
  char mainbuf[UNIXMESSAGE_BUFSIZE] ;
  char auxbuf[UNIXMESSAGE_AUXBUFSIZE] ;
} ;
#define UNIXCONNECTION_ZERO { .out = UNIXMESSAGE_SENDER_ZERO, .in = UNIXMESSAGE_RECEIVER_ZERO }
extern unixconnection_t const unixconnection_zero ;

extern void unixconnection_init (unixconnection_t *, int, int) ;
extern void unixconnection_free (unixconnection_t *) ;

#define unixconnection_flush(io) unixmessage_sender_flush(&(io)->out)
#define unixconnection_receive(io, m) unixmessage_receive(&(io)->in, m)

#endif