35
* This class allows new client sources to be written. This could be through
36
* network protocols, in-process threads, or any other client source that can
37
* provide commands and handle result sets. The current implementation is
38
* file-descriptor based, so for non-fd client sources (like from another
39
* thread), derived classes will need to use a pipe() for event notifications.
50
* Get attached session from the client object.
51
* @retval Session object that is attached, NULL if none.
36
virtual ~Protocol() {}
38
virtual void setSession(Session *session_arg)
53
43
virtual Session *getSession(void)
59
* Attach session to the client object.
60
* @param[in] session_arg Session object to attach, or NULL to clear.
62
virtual void setSession(Session *session_arg)
68
* Get file descriptor associated with client object.
69
* @retval File descriptor that is attached, -1 if none.
71
virtual int getFileDescriptor(void)= 0;
74
* Check to see if the client is currently connected.
75
* @retval Boolean value representing connected state.
77
virtual bool isConnected(void)= 0;
80
* Check to see if the client is actively reading.
81
* @retval Boolean value representing reading state.
48
virtual bool isConnected()= 0;
49
virtual void setReadTimeout(uint32_t timeout)= 0;
50
virtual void setWriteTimeout(uint32_t timeout)= 0;
51
virtual void setRetryCount(uint32_t count)= 0;
52
virtual void setError(char error)= 0;
53
virtual bool haveError(void)= 0;
54
virtual bool wasAborted(void)= 0;
55
virtual void enableCompression(void)= 0;
56
virtual bool haveMoreData(void)= 0;
83
57
virtual bool isReading(void)= 0;
86
* Check to see if the client is actively writing.
87
* @retval Boolean value representing writing state.
89
58
virtual bool isWriting(void)= 0;
92
* Flush all data that has been buffered with store() methods.
93
* @retval Boolean indicating success or failure.
95
virtual bool flush(void)= 0;
98
* Close the client object.
100
virtual void close(void)= 0;
103
* Perform handshake and authorize client if needed.
105
virtual bool authenticate(void)= 0;
108
* Read command from client.
110
virtual bool readCommand(char **packet, uint32_t *packet_length)= 0;
112
/* Send responses. */
113
virtual void sendOK(void)= 0;
114
virtual void sendEOF(void)= 0;
115
virtual void sendError(uint32_t sql_errno, const char *err)= 0;
118
* Send field list for result set.
120
virtual bool sendFields(List<Item> *list)= 0;
122
/* Send result fields in various forms. */
59
virtual bool setFileDescriptor(int fd)=0;
60
virtual int fileDescriptor(void)=0;
61
virtual void setRandom(uint64_t, uint64_t) {};
62
virtual bool authenticate(void)=0;
63
virtual bool readCommand(char **packet, uint32_t *packet_length)=0;
64
virtual void sendOK()= 0;
65
virtual void sendEOF()= 0;
66
virtual void sendError(uint32_t sql_errno, const char *err)=0;
67
virtual void close()= 0;
68
virtual void forceClose()= 0;
69
virtual void prepareForResend()= 0;
70
virtual void free()= 0;
71
virtual bool write()= 0;
73
enum { SEND_NUM_ROWS= 1, SEND_DEFAULTS= 2, SEND_EOF= 4 };
74
virtual bool sendFields(List<Item> *list, uint32_t flags)= 0;
123
76
virtual bool store(Field *from)= 0;
124
77
virtual bool store(void)= 0;
125
78
virtual bool store(int32_t from)= 0;
127
80
virtual bool store(int64_t from)= 0;
128
81
virtual bool store(uint64_t from)= 0;
129
82
virtual bool store(double from, uint32_t decimals, String *buffer)= 0;
130
virtual bool store(const DRIZZLE_TIME *from);
131
virtual bool store(const char *from);
132
virtual bool store(const char *from, size_t length)= 0;
134
/* Try to remove these. */
135
virtual bool haveMoreData(void)= 0;
136
virtual bool haveError(void)= 0;
137
virtual bool wasAborted(void)= 0;
141
} /* end namespace drizzled::plugin */
142
} /* end namespace drizzled */
144
#endif /* DRIZZLED_PLUGIN_CLIENT_H */
83
virtual bool store(const DRIZZLE_TIME *from)= 0;
84
virtual bool store(const char *from, const CHARSET_INFO * const cs)
88
return store(from, strlen(from), cs);
90
virtual bool store(const char *from, size_t length,
91
const CHARSET_INFO * const cs)= 0;
98
ProtocolFactory(std::string name_arg): name(name_arg) {}
99
ProtocolFactory(const char *name_arg): name(name_arg) {}
100
virtual ~ProtocolFactory() {}
101
virtual Protocol *operator()(void)= 0;
102
std::string getName() {return name;}
105
#endif /* DRIZZLED_PLUGIN_PROTOCOL_H */