MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TransporterCallback.hpp
1 /*
2  Copyright (C) 2003, 2005, 2006, 2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc.
3  All rights reserved. Use is subject to license terms.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; version 2 of the License.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 //****************************************************************************
20 //
21 // AUTHOR
22 // Åsa Fransson
23 //
24 // NAME
25 // TransporterCallback
26 //
27 //
28 //***************************************************************************/
29 #ifndef TRANSPORTER_CALLBACK_H
30 #define TRANSPORTER_CALLBACK_H
31 
32 #include <kernel_types.h>
33 #include "TransporterDefinitions.hpp"
34 
35 
36 #define TE_DO_DISCONNECT 0x8000
37 
38 enum TransporterError {
39  TE_NO_ERROR = 0,
47  TE_ERROR_CLOSING_SOCKET = 0x1,
48 
58  TE_ERROR_IN_SELECT_BEFORE_ACCEPT = 0x2,
59 
67  TE_INVALID_MESSAGE_LENGTH = 0x3 | TE_DO_DISCONNECT,
68 
76  TE_INVALID_CHECKSUM = 0x4 | TE_DO_DISCONNECT,
77 
85  TE_COULD_NOT_CREATE_SOCKET = 0x5,
86 
94  TE_COULD_NOT_BIND_SOCKET = 0x6,
95 
103  TE_LISTEN_FAILED = 0x7,
104 
114  TE_ACCEPT_RETURN_ERROR = 0x8
115 
123  ,TE_SHM_DISCONNECT = 0xb | TE_DO_DISCONNECT
124 
134  ,TE_SHM_IPC_STAT = 0xc | TE_DO_DISCONNECT
135 
139  ,TE_SHM_IPC_PERMANENT = 0x21
140 
149  ,TE_SHM_UNABLE_TO_CREATE_SEGMENT = 0xd
150 
159  ,TE_SHM_UNABLE_TO_ATTACH_SEGMENT = 0xe
160 
169  ,TE_SHM_UNABLE_TO_REMOVE_SEGMENT = 0xf
170 
171  ,TE_TOO_SMALL_SIGID = 0x10
172  ,TE_TOO_LARGE_SIGID = 0x11
173  ,TE_WAIT_STACK_FULL = 0x12 | TE_DO_DISCONNECT
174  ,TE_RECEIVE_BUFFER_FULL = 0x13 | TE_DO_DISCONNECT
175 
183  ,TE_SIGNAL_LOST_SEND_BUFFER_FULL = 0x14 | TE_DO_DISCONNECT
184 
192  ,TE_SIGNAL_LOST = 0x15
193 
199  ,TE_SEND_BUFFER_FULL = 0x16
200 
207  ,TE_SCI_UNABLE_TO_CLOSE_CHANNEL = 0x22
208 
216  ,TE_SCI_LINK_ERROR = 0x0017
217 
225  ,TE_SCI_UNABLE_TO_START_SEQUENCE = 0x18 | TE_DO_DISCONNECT
226 
232  ,TE_SCI_UNABLE_TO_REMOVE_SEQUENCE = 0x19 | TE_DO_DISCONNECT
233 
241  ,TE_SCI_UNABLE_TO_CREATE_SEQUENCE = 0x1a | TE_DO_DISCONNECT
242 
249  ,TE_SCI_UNRECOVERABLE_DATA_TFX_ERROR = 0x1b | TE_DO_DISCONNECT
250 
258  ,TE_SCI_CANNOT_INIT_LOCALSEGMENT = 0x1c | TE_DO_DISCONNECT
259 
267  ,TE_SCI_CANNOT_MAP_REMOTESEGMENT = 0x1d | TE_DO_DISCONNECT
268 
275  ,TE_SCI_UNABLE_TO_UNMAP_SEGMENT = 0x1e | TE_DO_DISCONNECT
276 
285  ,TE_SCI_UNABLE_TO_REMOVE_SEGMENT = 0x1f | TE_DO_DISCONNECT
286 
293  ,TE_SCI_UNABLE_TO_DISCONNECT_SEGMENT = 0x20 | TE_DO_DISCONNECT
294 
295  /* Used 0x21 */
296  /* Used 0x22 */
297 };
298 
305 public:
312  virtual void deliver_signal(SignalHeader * const header,
313  Uint8 prio,
314  Uint32 * const signalData,
315  LinearSectionPtr ptr[3]) = 0;
316 
329  virtual int checkJobBuffer() = 0;
330 
338  virtual void reportSendLen(NodeId nodeId, Uint32 count, Uint64 bytes) = 0;
339 
346  virtual void reportReceiveLen(NodeId nodeId, Uint32 count, Uint64 bytes) = 0;
347 
355  virtual void reportConnect(NodeId nodeId) = 0;
356 
364  virtual void reportDisconnect(NodeId nodeId, Uint32 errNo) = 0;
365 
372  virtual void reportError(NodeId nodeId, TransporterError errorCode,
373  const char *info = 0) = 0;
374 
380  virtual void transporter_recv_from(NodeId node) = 0;
381 
382 
396  virtual void lock_transporter(NodeId node) { }
397  virtual void unlock_transporter(NodeId node) { }
398 
417  virtual Uint32 get_bytes_to_send_iovec(NodeId, struct iovec *dst, Uint32) = 0;
418 
432  virtual Uint32 bytes_sent(NodeId node, Uint32 bytes) = 0;
433 
439  virtual bool has_data_to_send(NodeId node) = 0;
440 
447  virtual void reset_send_buffer(NodeId node, bool should_be_empty=false) = 0;
448 
449  virtual ~TransporterCallback() { };
450 };
451 
452 
464 public:
472  virtual Uint32 *getWritePtr(NodeId node, Uint32 lenBytes, Uint32 prio,
473  Uint32 max_use) = 0;
481  virtual Uint32 updateWritePtr(NodeId node, Uint32 lenBytes, Uint32 prio) = 0;
482 
488  virtual bool forceSend(NodeId node) = 0;
489 
490  virtual ~TransporterSendBufferHandle() { };
491 };
492 
493 #endif