#include <ndb_global.h>#include <my_sys.h>#include <mgmapi.h>#include <NdbOut.hpp>#include <Properties.hpp>#include <socket_io.h>#include <InputStream.hpp>#include <debugger/EventLogger.hpp>#include "ndb_logevent.hpp"Include dependency graph for ndb_logevent.cpp:

Go to the source code of this file.
Classes | |
| struct | ndb_logevent_error_msg |
| struct | ndb_logevent_handle |
| struct | Ndb_logevent_header_row |
Defines | |
| #define | ROW(a, b, c, d) |
| #define | ROW_FN(a, b, c, d, e) |
| #define | ROW2(a, b) |
Functions | |
| int | ndb_mgm_listen_event_internal (NdbMgmHandle, const int filter[], int) |
| NdbLogEventHandle | ndb_mgm_create_logevent_handle (NdbMgmHandle mh, const int filter[]) |
| void | ndb_mgm_destroy_logevent_handle (NdbLogEventHandle *h) |
| static int | ref_to_node (int ref) |
| static int | insert_row (const char *pair, Properties &p) |
| static int | memcpy_atoi (void *dst, const char *str, int sz) |
| int | ndb_logevent_get_next (const NdbLogEventHandle h, struct ndb_logevent *dst, unsigned timeout_in_milliseconds) |
| int | ndb_logevent_get_latest_error (const NdbLogEventHandle h) |
| const char * | ndb_logevent_get_latest_error_msg (const NdbLogEventHandle h) |
Variables | |
| ndb_logevent_error_msg | ndb_logevent_error_messages [] |
| Ndb_logevent_body_row | ndb_logevent_body [] |
| Ndb_logevent_header_row | ndb_logevent_header [] |
| #define ROW | ( | a, | |||
| b, | |||||
| c, | |||||
| d | ) |
Value:
{ NDB_LE_ ## a, b, c, 0, offsetof(struct ndb_logevent, a.d), \
sizeof(((struct ndb_logevent *)0)->a.d) }
Definition at line 83 of file ndb_logevent.cpp.
| #define ROW2 | ( | a, | |||
| b | ) |
Value:
{ a, offsetof(struct ndb_logevent, b), \
sizeof(((struct ndb_logevent *)0)->b) }
Definition at line 320 of file ndb_logevent.cpp.
| #define ROW_FN | ( | a, | |||
| b, | |||||
| c, | |||||
| d, | |||||
| e | ) |
Value:
{ NDB_LE_ ## a, b, c, e, offsetof(struct ndb_logevent, a.d), \
sizeof(((struct ndb_logevent *)0)->a.d) }
Definition at line 87 of file ndb_logevent.cpp.
| static int insert_row | ( | const char * | pair, | |
| Properties & | p | |||
| ) | [static] |
Definition at line 332 of file ndb_logevent.cpp.
References p, BaseString::split(), split(), trim(), and BaseString::trim().
Referenced by ndb_logevent_get_next().
00332 { 00333 BaseString tmp(pair); 00334 00335 tmp.trim(" \t\n\r"); 00336 Vector<BaseString> split; 00337 tmp.split(split, ":=", 2); 00338 if(split.size() != 2) 00339 return -1; 00340 p.put(split[0].trim().c_str(), split[1].trim().c_str()); 00341 00342 return 0; 00343 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static int memcpy_atoi | ( | void * | dst, | |
| const char * | str, | |||
| int | sz | |||
| ) | [static] |
Definition at line 346 of file ndb_logevent.cpp.
References atoi(), and memcpy.
Referenced by ndb_logevent_get_next().
00347 { 00348 switch (sz) 00349 { 00350 case 1: 00351 { 00352 Int8 val= atoi(str); 00353 memcpy(dst,&val,sz); 00354 return 0; 00355 } 00356 case 2: 00357 { 00358 Int16 val= atoi(str); 00359 memcpy(dst,&val,sz); 00360 return 0; 00361 } 00362 case 4: 00363 { 00364 Int32 val= atoi(str); 00365 memcpy(dst,&val,sz); 00366 return 0; 00367 } 00368 case 8: 00369 { 00370 Int64 val= atoi(str); 00371 memcpy(dst,&val,sz); 00372 return 0; 00373 } 00374 default: 00375 { 00376 return -1; 00377 } 00378 } 00379 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int ndb_mgm_listen_event_internal | ( | NdbMgmHandle | , | |
| const int | filter[], | |||
| int | ||||
| ) |
Definition at line 1387 of file mgmapi.cpp.
References BaseString::appfmt(), args, BaseString::c_str(), CHECK_HANDLE, CHECK_REPLY, SocketClient::connect(), handle, MGM_ARG, MGM_CMD, MGM_END, NDB_INVALID_SOCKET, ndb_mgm_call(), NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET, ndb_mgm_get_connected_host(), ndb_mgm_get_connected_port(), NDB_MGM_NO_ERROR, NDB_SOCKET_TYPE, NULL, port, SET_ERROR, setError(), and ndb_mgm_handle::socket.
Referenced by ndb_mgm_create_logevent_handle(), and ndb_mgm_listen_event().
01389 { 01390 SET_ERROR(handle, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_listen_event"); 01391 const ParserRow<ParserDummy> stat_reply[] = { 01392 MGM_CMD("listen event", NULL, ""), 01393 MGM_ARG("result", Int, Mandatory, "Error message"), 01394 MGM_ARG("msg", String, Optional, "Error message"), 01395 MGM_END() 01396 }; 01397 CHECK_HANDLE(handle, -1); 01398 01399 const char *hostname= ndb_mgm_get_connected_host(handle); 01400 int port= ndb_mgm_get_connected_port(handle); 01401 SocketClient s(hostname, port); 01402 const NDB_SOCKET_TYPE sockfd = s.connect(); 01403 if (sockfd == NDB_INVALID_SOCKET) { 01404 setError(handle, NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET, __LINE__, 01405 "Unable to connect to"); 01406 return -1; 01407 } 01408 01409 Properties args; 01410 01411 if (parsable) 01412 args.put("parsable", parsable); 01413 { 01414 BaseString tmp; 01415 for(int i = 0; filter[i] != 0; i += 2){ 01416 tmp.appfmt("%d=%d ", filter[i+1], filter[i]); 01417 } 01418 args.put("filter", tmp.c_str()); 01419 } 01420 01421 int tmp = handle->socket; 01422 handle->socket = sockfd; 01423 01424 const Properties *reply; 01425 reply = ndb_mgm_call(handle, stat_reply, "listen event", &args); 01426 01427 handle->socket = tmp; 01428 01429 if(reply == NULL) { 01430 close(sockfd); 01431 CHECK_REPLY(reply, -1); 01432 } 01433 return sockfd; 01434 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static int ref_to_node | ( | int | ref | ) | [static] |
| struct Ndb_logevent_body_row ndb_logevent_body[] |
Definition at line 95 of file ndb_logevent.cpp.
Referenced by Ndb_mgmd_event_service::log(), and ndb_logevent_get_next().
Initial value:
{
{ NDB_LEH_READ_ERROR, "Read error" },
{ NDB_LEH_MISSING_EVENT_SPECIFIER, "Missing event specifier" },
{ NDB_LEH_UNKNOWN_EVENT_VARIABLE, "Unknown event variable" },
{ NDB_LEH_UNKNOWN_EVENT_TYPE, "Unknown event type" },
{ NDB_LEH_INTERNAL_ERROR, "Unknown internal error" },
{ NDB_LEH_NO_ERROR,0}
}
Definition at line 38 of file ndb_logevent.cpp.
Referenced by ndb_logevent_get_latest_error_msg().
Initial value:
Definition at line 324 of file ndb_logevent.cpp.
Referenced by ndb_logevent_get_next().
1.4.7

