RDK Documentation (Open Sourced RDK Components)
rmh_monitor_events.c
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 #include <pthread.h>
20 #include <sys/time.h>
21 #include "rmh_monitor.h"
22 
23 /**
24  * The frequency in minutes that full network status should be dumpped in a stable environment.
25  */
26 #define RMH_MONITOR_STATUS_DUMP_MIN 60
27 
28 /**
29  * The frequency in minutes that a one line 'ping' message will appear in the logs when everything is stable.
30  */
31 #define RMH_MONITOR_STATUS_PING_MIN 2
32 
33 
34 /**
35  * The amount of time with no messages printed to the log that we will consider the network 'stable'
36  */
37 #define RMH_MONITOR_MIN_NETWORK_STABALIZE_SEC 10
38 
39 
40 /*******************************************************************************************************************
41 *
42 * Event Functions
43 *
44 * These fuctions are used to track events and control how they are managed.
45 *******************************************************************************************************************/
46 
47 /**
48  * This function is called to update the self node value
49 */
50 static inline
51 bool RMHMonitor_Event_SelfNodeId(RMHMonitor *app, struct timeval *time, const uint32_t nodeId) {
52  char printBuff[32];
53  RMH_Result ret;
54 
55  /* Ensure the link is up soemthing's actually changed */
56  if ((app->linkStatus != RMH_LINK_STATUS_UP) ||
57  (app->netStatus.selfNodeId == nodeId && app->netStatus.nodes[app->netStatus.selfNodeId].joined)) {
58  return false;
59  }
60 
61  /* Get some information about the node */
62  ret=RMH_Interface_GetMac(app->rmh, &app->netStatus.nodes[nodeId].mac);
63  if (ret != RMH_SUCCESS) {
64  RMH_PrintErr("RMH_Interface_GetMac failed -- %s!\n", RMH_ResultToString(ret));
65  }
66 
67  ret=RMH_Self_GetPreferredNCEnabled(app->rmh, &app->netStatus.nodes[nodeId].preferredNC);
68  if (ret != RMH_SUCCESS) {
69  RMH_PrintErr("RMH_Self_GetPreferredNCEnabled failed -- %s!\n", RMH_ResultToString(ret));
70  }
71 
72  ret=RMH_Self_GetHighestSupportedMoCAVersion(app->rmh, &app->netStatus.nodes[nodeId].mocaVersion);
73  if (ret != RMH_SUCCESS) {
74  RMH_PrintErr("RMH_Self_GetHighestSupportedMoCAVersion failed -- %s!\n", RMH_ResultToString(ret));
75  }
76 
77  RMH_PrintMsgT(time, "Node:%02u %s MoCA:%s PNC:%s **Self Node\n", nodeId, RMH_MoCAVersionToString(app->netStatus.nodes[nodeId].mocaVersion),
78  RMH_MacToString(app->netStatus.nodes[nodeId].mac, printBuff, sizeof(printBuff)),
79  app->netStatus.nodes[nodeId].preferredNC ? "TRUE" : "FALSE");
80 
81  app->netStatus.selfNodeId=nodeId;
82  app->netStatus.nodes[nodeId].joined=true;
83  return true;
84 }
85 
86 
87 /**
88  * This function is called when we expect that a node has joined the network
89 */
90 static inline
91 bool RMHMonitor_Event_JoinNode(RMHMonitor *app, struct timeval *time, const uint32_t nodeId) {
92  char printBuff[32];
93  RMH_Result ret;
94 
95  /* If the link is down do nothing */
96  if (app->linkStatus != RMH_LINK_STATUS_UP) {
97  return false;
98  }
99 
100  if (app->netStatus.nodes[nodeId].joined) {
101  /*RMH_PrintWrn("Got 'join' notification for node ID %u which was already on the network\n", nodeId);*/
102  return false;
103  }
104 
105  /* Get some information about the node */
106  ret=RMH_RemoteNode_GetMac(app->rmh, nodeId, &app->netStatus.nodes[nodeId].mac);
107  if (ret != RMH_SUCCESS) {
108  RMH_PrintErr("RMH_RemoteNode_GetMac failed -- %s!\n", RMH_ResultToString(ret));
109  }
110 
111  ret=RMH_RemoteNode_GetPreferredNC(app->rmh, nodeId, &app->netStatus.nodes[nodeId].preferredNC);
112  if (ret != RMH_SUCCESS) {
113  RMH_PrintErr("RMH_RemoteNode_GetPreferredNC failed -- %s!\n", RMH_ResultToString(ret));
114  }
115 
116  ret=RMH_RemoteNode_GetHighestSupportedMoCAVersion(app->rmh, nodeId, &app->netStatus.nodes[nodeId].mocaVersion);
117  if (ret != RMH_SUCCESS) {
118  RMH_PrintErr("RMH_RemoteNode_GetHighestSupportedMoCAVersion failed -- %s!\n", RMH_ResultToString(ret));
119  }
120 
121  RMH_PrintMsgT(time, "Node:%02u %s MoCA:%s PNC:%s\n", nodeId, RMH_MoCAVersionToString(app->netStatus.nodes[nodeId].mocaVersion),
122  RMH_MacToString(app->netStatus.nodes[nodeId].mac, printBuff, sizeof(printBuff)),
123  app->netStatus.nodes[nodeId].preferredNC ? "TRUE" : "FALSE");
124 
125  app->netStatus.nodes[nodeId].joined=true;
126  return true;
127 }
128 
129 
130 /**
131  * This function is called when we expect that a node has dropped from the network
132 */
133 static inline
134 bool RMHMonitor_Event_DropNode(RMHMonitor *app, struct timeval *time, const uint32_t nodeId) {
135  char printBuff[32];
136 
137  /* If the link is down do nothing */
138  if (app->linkStatus != RMH_LINK_STATUS_UP) {
139  return false;
140  }
141 
142  if (app->netStatus.nodes[nodeId].joined) {
143  RMH_PrintMsgT(time, "Node:%02u %s MoCA:%s PNC:%s %s\n", nodeId, RMH_MoCAVersionToString(app->netStatus.nodes[nodeId].mocaVersion),
144  RMH_MacToString(app->netStatus.nodes[nodeId].mac, printBuff, sizeof(printBuff)),
145  app->netStatus.nodes[nodeId].preferredNC ? "TRUE" : "FALSE",
146  app->netStatus.selfNodeId == nodeId ? "**Self node" : "");
147  }
148  else {
149  RMH_PrintWrn("Got 'drop' notification for node ID %u which is not on the network\n", nodeId);
150  }
151 
152  app->netStatus.nodes[nodeId].joined=false;
153  return true;
154 }
155 
156 
157 /**
158  * This function is called when we expect that MoCA 'network NC' has changed
159 */
160 static inline
161 bool RMHMonitor_Event_NCChanged(RMHMonitor *app, struct timeval *time, const uint32_t ncNodeId) {
162  char oldNC[32];
163  char newNC[32];
164 
165  /* Ensure the link is up soemthing's actually changed */
166  if ((app->linkStatus != RMH_LINK_STATUS_UP) ||
167  (app->netStatus.ncNodeIdValid && app->netStatus.ncNodeId == ncNodeId)) {
168  return false;
169  }
170 
171  if (app->netStatus.ncNodeIdValid) {
172  RMH_PrintMsgT(time, "NC is now node:%02u %s [Previous:%02u %s]\n", ncNodeId, RMH_MacToString(app->netStatus.nodes[ncNodeId].mac, newNC, sizeof(newNC)),
173  app->netStatus.ncNodeId, RMH_MacToString(app->netStatus.nodes[app->netStatus.ncNodeId].mac, oldNC, sizeof(oldNC)));
174  }
175  else {
176  RMH_PrintMsgT(time, "NC is now node:%02u %s\n", ncNodeId, RMH_MacToString(app->netStatus.nodes[ncNodeId].mac, newNC, sizeof(newNC)));
177  }
178  app->netStatus.ncNodeId=ncNodeId;
179  app->netStatus.ncNodeIdValid=true;
180  return true;
181 }
182 
183 
184 /**
185  * This function is called when we expect that MoCA 'network version' has changed
186 */
187 static inline
188 bool RMHMonitor_Event_NetworkMoCAVersionChanged(RMHMonitor *app, struct timeval *time, const RMH_MoCAVersion mocaVersion) {
189  /* Ensure the link is up soemthing's actually changed */
190  if ((app->linkStatus != RMH_LINK_STATUS_UP) ||
191  (app->netStatus.networkMoCAVerValid && app->netStatus.networkMoCAVer == mocaVersion)) {
192  return false;
193  }
194 
195  if (app->netStatus.networkMoCAVerValid) {
196  RMH_PrintMsgT(time, "MoCA network is now %s [Previous: %s]\n", RMH_MoCAVersionToString(mocaVersion),
197  RMH_MoCAVersionToString(app->netStatus.networkMoCAVer));
198  }
199  else {
200  RMH_PrintMsgT(time, "MoCA network is now %s\n", RMH_MoCAVersionToString(mocaVersion));
201  }
202 
203  app->netStatus.networkMoCAVer=mocaVersion;
204  app->netStatus.networkMoCAVerValid=true;
205  return true;
206 }
207 
208 
209 /**
210  * This function is called when we expect that MoCA 'link' status has changed
211 */
212 static inline
213 bool RMHMonitor_Event_LinkStatusChanged(RMHMonitor *app, struct timeval *time, const RMH_LinkStatus linkStatus) {
214  /* Ensure soemthing's actually changed */
215  if (app->linkStatusValid && app->linkStatus == linkStatus) {
216  return false;
217  }
218 
219  RMH_PrintMsgT(time, "MoCA link is now %s!\n", RMH_LinkStatusToString(linkStatus));
220  app->linkStatus=linkStatus;
221  app->linkStatusValid=true;
222 
223  if (app->linkStatus == RMH_LINK_STATUS_UP) {
224  /* Link is up, update netstatus */
225  RMH_Result ret;
226  int i;
227  uint32_t nodeId;
228  RMH_MoCAVersion networkMoCAVer;
229  RMH_NodeList_Uint32_t nodeIds;
230 
231  ret=RMH_Network_GetNodeId(app->rmh, &nodeId);
232  if (ret != RMH_SUCCESS) {
233  RMH_PrintErr("RMH_Interface_GetMac failed -- %s!\n", RMH_ResultToString(ret));
234  }
235  else {
236  RMHMonitor_Event_SelfNodeId(app, time, nodeId);
237  }
238 
239  ret=RMH_Network_GetRemoteNodeIds(app->rmh, &nodeIds);
240  if (ret != RMH_SUCCESS) {
241  RMH_PrintErr("RMH_Network_GetRemoteNodeIds failed -- %s!\n", RMH_ResultToString(ret));
242  }
243  else {
244  for (i = 0; i < RMH_MAX_MOCA_NODES; i++) {
245  if (nodeIds.nodePresent[i]) {
246  RMHMonitor_Event_JoinNode(app, time, i);
247  }
248  }
249  }
250 
251  ret=RMH_Network_GetNCNodeId(app->rmh, &nodeId);
252  if (ret != RMH_SUCCESS) {
253  RMH_PrintErr("RMH_Network_GetRemoteNodeIds failed -- %s!\n", RMH_ResultToString(ret));
254  }
255  else {
256  RMHMonitor_Event_NCChanged(app, time, nodeId);
257  }
258 
259  ret=RMH_Network_GetMoCAVersion(app->rmh, &networkMoCAVer);
260  if (ret != RMH_SUCCESS) {
261  RMH_PrintErr("RMH_Network_GetMoCAVersion failed -- %s!\n", RMH_ResultToString(ret));
262  }
263  else {
264  RMHMonitor_Event_NetworkMoCAVersionChanged(app, time, networkMoCAVer);
265  }
266  }
267  else {
268  /* MoCA is down, invalidate net status */
269  memset(&app->netStatus, 0, sizeof(app->netStatus));
270  }
271  return true;
272 }
273 
274 
275 /**
276  * This function should print a single line status. Mainly to indicate the logger is still alive
277  */
278 static
279 void RMHMonitor_Event_PrintPing(RMHMonitor *app, struct timeval *time) {
280  bool mocaEnabled;
281  if (RMH_Self_GetEnabled(app->rmh, &mocaEnabled) != RMH_SUCCESS || !mocaEnabled) {
282  RMH_PrintMsgT(time, "Link:DISABLED\n");
283  }
284  else if (app->linkStatus != RMH_LINK_STATUS_UP) {
285  RMH_PrintMsgT(time, "Link:DOWN\n");
286  }
287  else {
288  uint32_t numNodes, ncNode, selfNode, uptime;
289  int32_t numNodesPrint, ncNodePrint, selfNodePrint, uptimePrint;
290  numNodesPrint = RMH_Network_GetNumNodes(app->rmh, &numNodes) == RMH_SUCCESS ? numNodes : -1;
291  selfNodePrint = RMH_Network_GetNodeId(app->rmh, &selfNode) == RMH_SUCCESS ? selfNode : -1;
292  ncNodePrint = RMH_Network_GetNCNodeId(app->rmh, &ncNode) == RMH_SUCCESS ? ncNode : -1;
293  uptimePrint= RMH_Network_GetLinkUptime(app->rmh, &uptime) == RMH_SUCCESS ? uptime : 0;
294  RMH_PrintMsgT(time, "Link:UP [%02uh:%02um:%02us] Nodes:%d Self:%d NC:%d\n", uptimePrint/3600, (uptimePrint%3600)/60, uptimePrint%60, numNodesPrint, selfNodePrint, ncNodePrint);
295  }
296 }
297 
298 
299 /**
300  * This function should print a full status summary.
301  */
302 static
303 void RMHMonitor_Event_PrintFull(RMHMonitor *app, struct timeval *time) {
304  bool mocaEnabled = false;
305  RMH_Handle rmh=app->rmh;
306 
307  /*********************************************************************
308  * We're seeing an issue where after some time (30+ minutes) the MoCA
309  * driver is having issues using handles that have sat inactive. For
310  * Now we'll just create a new temporary handle to dump the status.
311  * Eventually, when this bug is fixed, we should remove this and use
312  * the default handle 'app->rmh'
313  **********************************************************************/
314  rmh=RMH_Initialize(RMHMonitor_RMHCallback, app);
315  if (rmh && RMH_Log_SetAPILevel(rmh, RMH_LOG_DEFAULT ) != RMH_SUCCESS) {
316  RMH_PrintErr("Failed to set the log level on temporary status handle!\n");
317  RMH_Destroy(rmh);
318  rmh=NULL;
319  }
320  if (rmh && RMH_SetEventCallbacks(rmh, RMH_EVENT_API_PRINT) != RMH_SUCCESS) {
321  RMH_PrintErr("Failed setting callback events on temporary status handle!\n");
322  RMH_Destroy(rmh);
323  rmh=NULL;
324  }
325  if (!rmh) {
326  rmh=app->rmh;
327  }
328  /**********************************************************************/
329 
330  if (RMH_Self_GetEnabled(rmh, &mocaEnabled) == RMH_SUCCESS && mocaEnabled) {
331  RMH_PrintMsg("==============================================================================================================================\n");
332  RMH_Log_PrintStatus(rmh, NULL);
333  RMH_PrintMsg("==============================================================================================================================\n");
334  RMH_Log_PrintStats(rmh, NULL);
335  RMH_PrintMsg("==============================================================================================================================\n");
336  RMH_Log_PrintModulation(rmh, NULL);
337  RMH_PrintMsg("==============================================================================================================================\n");
338  RMH_Log_PrintFlows(rmh, NULL);
339  RMH_PrintMsg("==============================================================================================================================\n");
340  }
341 
342  /**********************************************************************/
343  if (rmh != app->rmh) {
344  RMH_Destroy(rmh);
345  }
346  /**********************************************************************/
347 }
348 
349 
350 /**
351  * This is the main event thread. It will monitor the event queue and when an even occurs it will take some action
352 */
353 void RMHMonitor_Event_Thread(void * context) {
354  RMHMonitor *app=(RMHMonitor *)context;
356  RMH_Result ret;
357  bool networkStable=false;
358  bool mocaEnabled;
359  char printBuff[128];
360  bool printStatus = false;
361  struct timeval now;
362  struct timeval lastStatusPrint;
363  struct timeval lastStatusPing;
364  int threadRet=1;
365 
366  /* Reset internal status */
367  app->linkStatusValid=false;
368  memset(&app->netStatus, 0, sizeof(app->netStatus));
369 
370  /* Validate the handle */
371  ret = RMH_ValidateHandle(app->rmh);
372  if (ret == RMH_UNIMPLEMENTED || ret == RMH_NOT_SUPPORTED) {
373  RMH_PrintWrn("RMH_ValidateHandle returned %s. We will not be able to monitor to make sure the handle remains valid\n", RMH_ResultToString(ret));
374  }
375  else if (ret != RMH_SUCCESS) {
376  RMH_PrintErr("The RMH handle %p seems to no longer be valid. Aborting\n", app->rmh);
377  goto exit_err;
378  }
379 
380  /* Dump a full status to get things started */
381  gettimeofday(&now, NULL);
382 
383  if (RMH_Self_GetEnabled(app->rmh, &mocaEnabled) != RMH_SUCCESS) {
384  goto exit_err;
385  }
386  else if (mocaEnabled) {
387  RMH_LinkStatus linkStatus;
388  if (RMH_Self_GetLinkStatus(app->rmh, &linkStatus) == RMH_SUCCESS) {
389  RMHMonitor_Event_LinkStatusChanged(app, &now, linkStatus);
390  }
391  }
392  else {
393  RMHMonitor_Event_LinkStatusChanged(app, &now, RMH_LINK_STATUS_DISABLED);
394  }
395  RMHMonitor_Event_PrintFull(app, &now);
396 
397  /* Looks like we're connected with a valid handle, reset the timer */
398  app->reconnectSeconds=0;
399 
400  app->appPrefix=NULL;
401  lastStatusPrint=now;
402  lastStatusPing=now;
403 
404  /* Loop forever here until the thread is no longer running */
405  while (app->eventThreadRunning) {
406  ret=RMHMonitor_Semaphore_WaitTimeout(app->eventNotify, 2000);
407  if (ret == RMH_FAILURE) {
408  RMH_PrintErr("Failed in RMHMonitor_Semaphore_WaitTimeout\n");
409  }
410 
411  gettimeofday(&now, NULL);
412 
413  ret = RMH_ValidateHandle(app->rmh);
414  if (ret != RMH_SUCCESS && ret != RMH_UNIMPLEMENTED && ret != RMH_NOT_SUPPORTED) {
415  RMH_PrintErr("The RMH handle %p seems to no longer be valid. Aborting\n", app->rmh);
416  goto exit_err;
417  }
418 
419  /* We determine that the network is 'stable' when there hasn't been anything print to the
420  * log in at least RMH_MONITOR_MIN_NETWORK_STABALIZE seconds. We can't just use the semaphore
421  * timeout because we might get repeated messages from the MoCA driver which aren't being print
422  * to the log (no change). In that case it will look like the log is frozen.
423  */
424  networkStable=(now.tv_sec-app->lastPrint.tv_sec) > RMH_MONITOR_MIN_NETWORK_STABALIZE_SEC;
425 
426  /* We want to first check if we have any pending prints. This will happen because either
427  * 1) An event occurred which indicated a dump should happen
428  * 2) It has been RMH_MONITOR_STATUS_DUMP_MIN minutes has passed since the last status dump
429  *
430  * Note: Before we print anything make sure the network is stable. This is to make sure we don't
431  * flood logs with status updates if the network is changing frequently.
432  */
433  if ((now.tv_sec-lastStatusPrint.tv_sec) > RMH_MONITOR_STATUS_DUMP_MIN*60 ||
434  (printStatus && networkStable)) {
435  /* Dump the full status and update the last print time */
436  RMHMonitor_Event_PrintFull(app, &now);
437  app->appPrefix=NULL;
438  lastStatusPrint=now;
439  lastStatusPing=now;
440  printStatus=false;
441  }
442  else if (networkStable && (lastStatusPing.tv_sec == 0 || (now.tv_sec-lastStatusPing.tv_sec) > RMH_MONITOR_STATUS_PING_MIN*60)) {
443  /* Dump the ping status and update the last print time */
444  RMHMonitor_Event_PrintPing(app, &now);
445  lastStatusPing=now;
446  }
447 
448  /* We're all caught up on prints, check if there are any events in the queue */
449  cbE = app->eventQueue.tqh_first;
450  if (cbE) {
451  /* There is a pending event, handle it */
452  switch(cbE->event) {
453  case RMH_EVENT_ADMISSION_STATUS_CHANGED:
454  RMH_PrintMsgT(&cbE->eventTime, "[ADMNSTUS] Admission status: %s\n", RMH_AdmissionStatusToString(cbE->eventData.RMH_EVENT_ADMISSION_STATUS_CHANGED.status));
455  break;
456  case RMH_EVENT_LINK_STATUS_CHANGED:
457  app->appPrefix="[CHANGE] ";
458  printStatus|=RMHMonitor_Event_LinkStatusChanged(app, &cbE->eventTime, cbE->eventData.RMH_EVENT_LINK_STATUS_CHANGED.status);
459  break;
460  case RMH_EVENT_MOCA_RESET:
461  RMH_PrintMsgT(&cbE->eventTime, "[*RESET* ] MoCA Reset triggered - %s\n", RMH_MoCAResetReasonToString(cbE->eventData.RMH_EVENT_MOCA_RESET.reason));
462  break;
463  case RMH_EVENT_MOCA_VERSION_CHANGED:
464  app->appPrefix="[CHANGE] ";
465  printStatus|=RMHMonitor_Event_NetworkMoCAVersionChanged(app, &cbE->eventTime, cbE->eventData.RMH_EVENT_MOCA_VERSION_CHANGED.version);
466  break;
467  case RMH_EVENT_NODE_JOINED:
468  app->appPrefix="[CHANGE] ";
469  printStatus|=RMHMonitor_Event_JoinNode(app, &cbE->eventTime, cbE->eventData.RMH_EVENT_NODE_JOINED.nodeId);
470  break;
471  case RMH_EVENT_NODE_DROPPED:
472  app->appPrefix="[CHANGE] ";
473  printStatus|=RMHMonitor_Event_DropNode(app, &cbE->eventTime, cbE->eventData.RMH_EVENT_NODE_JOINED.nodeId);
474  break;
475  case RMH_EVENT_NC_ID_CHANGED:
476  if (cbE->eventData.RMH_EVENT_NC_ID_CHANGED.ncValid) {
477  app->appPrefix="[CHANGE] ";
478  printStatus|=RMHMonitor_Event_NCChanged(app, &cbE->eventTime, cbE->eventData.RMH_EVENT_NC_ID_CHANGED.ncNodeId);
479  }
480  break;
481  case RMH_EVENT_LOW_BANDWIDTH:
482  RMH_PrintMsgT(&cbE->eventTime, "WARNING: Low bandwidth reported\n");
483  break;
484  default:
485  RMH_PrintMsgT(&cbE->eventTime, "WARNING: Unhandled MoCA event %s!\n", RMH_EventToString(cbE->event, printBuff, sizeof(printBuff)));
486  break;
487  }
488  /* If we have a request to print the full status, keep the prefix and we'll clear it later. If not clear it now. */
489  if (!printStatus) app->appPrefix=NULL;
490 
491  /* Clear this handled event off the queue */
492  RMHMonitor_Queue_Dequeue(app);
493  }
494  }
495 
496  ret=0;
497  pthread_exit(&threadRet);
498 
499 exit_err:
500  ret=1;
501  pthread_exit(&threadRet);
502 }
RMH_Self_GetPreferredNCEnabled
RMH_Result RMH_Self_GetPreferredNCEnabled(const RMH_Handle handle, bool *response)
Return if this device is a preferred NC.
RMH_Self_GetLinkStatus
RMH_Result RMH_Self_GetLinkStatus(const RMH_Handle handle, RMH_LinkStatus *status)
Current operational status of the MoCA interface [mocaIfStatus].
RMH_AdmissionStatusToString
const char *const RMH_AdmissionStatusToString(const RMH_AdmissionStatus value)
Convert RMH_AdmissionStatus to a string.
Definition: librmh_api_no_wrap.c:92
RMH_RemoteNode_GetMac
RMH_Result RMH_RemoteNode_GetMac(const RMH_Handle handle, const uint32_t nodeId, RMH_MacAddress_t *response)
Return the MAC address of the remote node specified by nodeId.
RMH_Network_GetLinkUptime
RMH_Result RMH_Network_GetLinkUptime(const RMH_Handle handle, uint32_t *response)
Returns the amount of time this node has been part of the MoCA network [mocaIfLinkUpTime].
RMH_RemoteNode_GetPreferredNC
RMH_Result RMH_RemoteNode_GetPreferredNC(const RMH_Handle handle, const uint32_t nodeId, bool *response)
Return if the node indicated by nodeId is a preferred NC or not.
RMH_NodeList_Uint32_t
Definition: rmh_type.h:195
RMH_MoCAVersionToString
const char *const RMH_MoCAVersionToString(const RMH_MoCAVersion value)
Convert RMH_MoCAVersion to a string.
Definition: librmh_api_no_wrap.c:122
RMH_Network_GetNodeId
RMH_Result RMH_Network_GetNodeId(const RMH_Handle handle, uint32_t *response)
Return the node ID of this device.
RMHMonitor
Definition: rmh_monitor.h:77
RMH_RemoteNode_GetHighestSupportedMoCAVersion
RMH_Result RMH_RemoteNode_GetHighestSupportedMoCAVersion(const RMH_Handle handle, const uint32_t nodeId, RMH_MoCAVersion *response)
Return the highest supported version of MoCA by the remote node specified by nodeId.
RMH_Self_GetHighestSupportedMoCAVersion
RMH_Result RMH_Self_GetHighestSupportedMoCAVersion(const RMH_Handle handle, RMH_MoCAVersion *response)
Return the highest version of MoCA supported by the MoCA driver on this device. [mocaIfMocaVersion].
RMH_Network_GetNumNodes
RMH_Result RMH_Network_GetNumNodes(const RMH_Handle handle, uint32_t *response)
Return the number of MoCA nodes in the network. [mocaIfNumNodes].
RMH_LinkStatusToString
const char *const RMH_LinkStatusToString(const RMH_LinkStatus value)
Convert RMH_LinkStatus to a string.
Definition: librmh_api_no_wrap.c:88
RMH
Definition: librmh.h:57
RMH_MoCAResetReasonToString
const char *const RMH_MoCAResetReasonToString(const RMH_MoCAResetReason value)
Convert RMH_MoCAResetReason to a string.
Definition: librmh_api_no_wrap.c:108
RMH_MacToString
const char *const RMH_MacToString(const RMH_MacAddress_t value, char *responseBuf, const size_t responseBufSize)
Returns the provided MAC address in value as a string.
Definition: librmh_api_no_wrap.c:174
RMH_Initialize
RMH_Handle RMH_Initialize(const RMH_EventCallback eventCB, void *userContext)
Initialize the RMH library and return a handle to the instance.
Definition: librmh_api_no_wrap.c:23
RMH_Interface_GetMac
RMH_Result RMH_Interface_GetMac(const RMH_Handle handle, RMH_MacAddress_t *response)
Return the MAC address associated with this MoCA device. [mocaIfMacAddress].
RMH_Network_GetNCNodeId
RMH_Result RMH_Network_GetNCNodeId(const RMH_Handle handle, uint32_t *response)
Return the node ID of the network coordinator. [mocaIfNC].
RMHMonitor_CallbackEvent
Definition: rmh_monitor.h:41
RMH_ResultToString
const char *const RMH_ResultToString(const RMH_Result value)
Convert RMH_Result to a string.
Definition: librmh_api_no_wrap.c:84
RMH_Log_SetAPILevel
RMH_Result RMH_Log_SetAPILevel(const RMH_Handle handle, const uint32_t value)
Set the log level of the RMH library.
RMH_SetEventCallbacks
RMH_Result RMH_SetEventCallbacks(RMH_Handle handle, const uint32_t value)
Set the list of callbacks you wish to receive.
RMH_Destroy
RMH_Result RMH_Destroy(RMH_Handle handle)
Destroy the instance of RMH library which was created by RMH_Initialize.
RMH_Log_PrintFlows
RMH_Result RMH_Log_PrintFlows(const RMH_Handle handle, const char *filename)
Print a generic status summary of the MoCA flows.
RMH_Self_GetEnabled
RMH_Result RMH_Self_GetEnabled(const RMH_Handle handle, bool *response)
Return if the MoCA driver is actively connected to or attempting to connect to a MoCA network.
RMH_Log_PrintStatus
RMH_Result RMH_Log_PrintStatus(const RMH_Handle handle, const char *filename)
Print a generic status summary of the MoCA device and network.
RMH_Log_PrintStats
RMH_Result RMH_Log_PrintStats(const RMH_Handle handle, const char *filename)
Print a summary of of the Tx/Rx MoCA status.
RMH_EventToString
const char *const RMH_EventToString(const uint32_t value, char *responseBuf, const size_t responseBufSize)
Return the bitmask value as a string.
Definition: librmh_api_no_wrap.c:170
RMH_Log_PrintModulation
RMH_Result RMH_Log_PrintModulation(const RMH_Handle handle, const char *filename)
Print a summary of the sub carrier modulation bitloading information.
RMH_Network_GetRemoteNodeIds
RMH_Result RMH_Network_GetRemoteNodeIds(const RMH_Handle handle, RMH_NodeList_Uint32_t *response)
Return a list of every node ID on the network.
RMH_Network_GetMoCAVersion
RMH_Result RMH_Network_GetMoCAVersion(const RMH_Handle handle, RMH_MoCAVersion *response)
Return the version of MoCA under which the network is operating. [mocaIfNetworkVersion].