~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to vio/violite.h

  • Committer: Monty Taylor
  • Date: 2008-09-15 17:24:04 UTC
  • Revision ID: monty@inaugust.com-20080915172404-ygh6hiyu0q7qpa9x
Removed strndup calls.

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