~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to vio/violite.h

  • Committer: Brian Aker
  • Date: 2008-11-04 15:39:09 UTC
  • mfrom: (575.1.2 devel)
  • Revision ID: brian@tangent.org-20081104153909-c72hn65udxs1ccal
Merge of Monty's work

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#ifndef vio_violite_h_
22
22
#define vio_violite_h_
23
23
 
 
24
#include <sys/socket.h>
 
25
#include <errno.h>
 
26
 
24
27
/* Simple vio interface in C;  The functions are implemented in violite.c */
25
28
 
26
29
#ifdef  __cplusplus
34
37
};
35
38
 
36
39
 
 
40
struct st_vio;                                  /* Only C */
 
41
typedef struct st_vio Vio;
 
42
 
37
43
#define VIO_LOCALHOST 1                         /* a localhost connection */
38
44
#define VIO_BUFFERED_READ 2                     /* use buffered read */
39
45
#define VIO_READ_BUFFER_SIZE 16384              /* size of read buffer */
40
46
 
41
 
Vio*    vio_new(int sd, enum enum_vio_type type, uint flags);
 
47
Vio*    vio_new(int sd, enum enum_vio_type type, unsigned int flags);
42
48
 
43
49
void    vio_delete(Vio* vio);
44
50
int     vio_close(Vio* vio);
45
51
void    vio_reset(Vio* vio, enum enum_vio_type type, int sd, uint32_t flags);
46
 
size_t  vio_read(Vio *vio, uchar *      buf, size_t size);
47
 
size_t  vio_read_buff(Vio *vio, uchar * buf, size_t size);
48
 
size_t  vio_write(Vio *vio, const uchar * buf, size_t size);
 
52
size_t  vio_read(Vio *vio, unsigned char *      buf, size_t size);
 
53
size_t  vio_read_buff(Vio *vio, unsigned char * buf, size_t size);
 
54
size_t  vio_write(Vio *vio, const unsigned char * buf, size_t size);
49
55
int     vio_blocking(Vio *vio, bool onoff, bool *old_mode);
50
56
bool    vio_is_blocking(Vio *vio);
51
57
/* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible */
67
73
/* Remote peer's address and name in text form */
68
74
bool vio_peer_addr(Vio *vio, char *buf, uint16_t *port, size_t buflen);
69
75
bool vio_poll_read(Vio *vio, int timeout);
70
 
bool vio_peek_read(Vio *vio, uint *bytes);
 
76
bool vio_peek_read(Vio *vio, unsigned int *bytes);
71
77
 
72
78
void vio_end(void);
73
79
 
121
127
  /* function pointers. They are similar for socket/SSL/whatever */
122
128
  void    (*viodelete)(Vio*);
123
129
  int32_t     (*vioerrno)(Vio*);
124
 
  size_t  (*read)(Vio*, uchar *, size_t);
125
 
  size_t  (*write)(Vio*, const uchar *, size_t);
 
130
  size_t  (*read)(Vio*, unsigned char *, size_t);
 
131
  size_t  (*write)(Vio*, const unsigned char *, size_t);
126
132
  int32_t     (*vioblocking)(Vio*, bool, bool *);
127
133
  bool (*is_blocking)(Vio*);
128
134
  int32_t     (*viokeepalive)(Vio*, bool);