~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to include/violite.h

  • Committer: Jay Pipes
  • Date: 2008-07-21 17:52:33 UTC
  • mto: (201.2.1 drizzle)
  • mto: This revision was merged to the branch mainline in revision 204.
  • Revision ID: jay@mysql.com-20080721175233-mtyz298j8xl3v63y
cleanup of FAQ file

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>
 
24
#include "my_net.h"                     /* needed because of struct in_addr */
 
25
 
26
26
 
27
27
/* Simple vio interface in C;  The functions are implemented in violite.c */
28
28
 
41
41
#define VIO_BUFFERED_READ 2                     /* use buffered read */
42
42
#define VIO_READ_BUFFER_SIZE 16384              /* size of read buffer */
43
43
 
44
 
Vio*    vio_new(int sd, enum enum_vio_type type, unsigned int flags);
 
44
Vio*    vio_new(my_socket sd, enum enum_vio_type type, uint flags);
45
45
 
46
46
void    vio_delete(Vio* vio);
47
47
int     vio_close(Vio* vio);
48
 
void    vio_reset(Vio* vio, enum enum_vio_type type, int sd, uint32_t flags);
49
 
size_t  vio_read(Vio *vio, unsigned char *      buf, size_t size);
50
 
size_t  vio_read_buff(Vio *vio, unsigned char * buf, size_t size);
51
 
size_t  vio_write(Vio *vio, const unsigned char * buf, size_t size);
 
48
void    vio_reset(Vio* vio, enum enum_vio_type type, my_socket sd, uint32_t flags);
 
49
size_t  vio_read(Vio *vio, uchar *      buf, size_t size);
 
50
size_t  vio_read_buff(Vio *vio, uchar * buf, size_t size);
 
51
size_t  vio_write(Vio *vio, const uchar * buf, size_t size);
52
52
int     vio_blocking(Vio *vio, bool onoff, bool *old_mode);
53
53
bool    vio_is_blocking(Vio *vio);
54
54
/* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible */
66
66
/* Return last error number */
67
67
int     vio_errno(Vio*vio);
68
68
/* Get socket number */
69
 
int vio_fd(Vio*vio);
 
69
my_socket vio_fd(Vio*vio);
70
70
/* Remote peer's address and name in text form */
71
 
bool vio_peer_addr(Vio *vio, char *buf, uint16_t *port, size_t buflen);
72
 
bool vio_poll_read(Vio *vio, int timeout);
73
 
bool vio_peek_read(Vio *vio, unsigned int *bytes);
 
71
bool vio_peer_addr(Vio *vio, char *buf, uint16 *port, size_t buflen);
 
72
bool    vio_poll_read(Vio *vio,uint timeout);
 
73
bool vio_peek_read(Vio *vio, uint *bytes);
74
74
 
75
75
void vio_end(void);
76
76
 
110
110
/* This structure is for every connection on both sides */
111
111
struct st_vio
112
112
{
113
 
  int           sd;             /* int - real or imaginary */
 
113
  my_socket             sd;             /* my_socket - real or imaginary */
114
114
  int                   fcntl_mode;     /* Buffered fcntl(sd,F_GETFL) */
115
115
  struct sockaddr_storage       local;          /* Local internet address */
116
116
  struct sockaddr_storage       remote;         /* Remote internet address */
124
124
  /* function pointers. They are similar for socket/SSL/whatever */
125
125
  void    (*viodelete)(Vio*);
126
126
  int32_t     (*vioerrno)(Vio*);
127
 
  size_t  (*read)(Vio*, unsigned char *, size_t);
128
 
  size_t  (*write)(Vio*, const unsigned char *, size_t);
 
127
  size_t  (*read)(Vio*, uchar *, size_t);
 
128
  size_t  (*write)(Vio*, const uchar *, size_t);
129
129
  int32_t     (*vioblocking)(Vio*, bool, bool *);
130
130
  bool (*is_blocking)(Vio*);
131
131
  int32_t     (*viokeepalive)(Vio*, bool);
135
135
  bool (*should_retry)(Vio*);
136
136
  bool (*was_interrupted)(Vio*);
137
137
  int32_t     (*vioclose)(Vio*);
138
 
  void    (*timeout)(Vio*, bool is_sndtimeo, int32_t timeout);
 
138
  void    (*timeout)(Vio*, uint32_t which, uint32_t timeout);
139
139
  char                  *read_buffer;   /* buffer for vio_read_buff */
140
140
};
141
141
#endif /* vio_violite_h_ */