![]() |
netmsgs
1.2.2
RoadNarrows Robotics Network Messaging Package
|
Example NetMsgs message packing/unpacking application. More...
#include <stdio.h>#include <unistd.h>#include <stdlib.h>#include <libgen.h>#include <string.h>#include "rnr/rnrconfig.h"#include "rnr/new.h"#include "rnr/opts.h"#include "rnr/log.h"#include "rnr/netmsgs.h"#include "nmExample.h"#include "AstroMsgs.h"#include "version.h"Go to the source code of this file.
Macros | |
| #define | APP_EC_OK 0 |
| success exit code | |
| #define | APP_EC_USAGE 2 |
| usage error exit code | |
| #define | APP_EC_EXEC 4 |
| execution error exit code | |
| #define | MSG_NS "Astro" |
| message namespace | |
| #define | CAT(a, b) a ## b |
| Concatenate two tokens. More... | |
| #define | CAT3(a, b, c) a ## b ## c |
| Concatenate three tokens. More... | |
| #define | PRCMP(mem, fmt) |
| Print side-by-side comparision of prepacked tx and post-unpacked rx member. More... | |
| #define | IDENTITY(xmlname, txmsg, rxmsg) |
| Execute the pack, unpack identiy function. More... | |
Typedefs | |
| typedef int(* | Packer_T) (void *, byte_t[], size_t, bool_t) |
| packer type | |
| typedef int(* | Unpacker_T) (byte_t[], size_t, void *, bool_t) |
| unpacker type | |
| typedef int(* | tstfunc_t) () |
Functions | |
| static int | MainInit (int argc, char *argv[]) |
| Initialize simple_khr2 command. More... | |
| int | Identity (const char *sXmlName, Packer_T fnPacker, void *pTxMsg, Unpacker_T fnUnpacker, void *pRxMsg) |
| Execute the pack, unpack identiy function. More... | |
| int | tstRspErr () |
| Test AstroRspMsg message packing and unpacking. More... | |
| int | tstCmdZodiac () |
| Test CmdZodiac message packing and unpacking. More... | |
| int | tstCmdUniverse () |
| Test CmdUniverse message packing and unpacking. More... | |
| int | main (int argc, char *argv[]) |
| Simple NetMsg example main. More... | |
Variables | |
| static char * | Argv0 |
| this command basename | |
| static bool_t | OptsTrace = false |
| do [not] trace packing/unpacking | |
| static OptsPgmInfo_T | PgmInfo |
| Program information. More... | |
| static OptsInfo_T | OptsInfo [] |
| Command-line options information. More... | |
| tstfunc_t | TstTbl [] |
Example NetMsgs message packing/unpacking application.
Definition in file nmExample.c.
| #define CAT | ( | a, | |
| b | |||
| ) | a ## b |
| #define CAT3 | ( | a, | |
| b, | |||
| c | |||
| ) | a ## b ## c |
Concatenate three tokens.
| a | Token a. |
| b | Token b. |
| c | Token c. |
Definition at line 177 of file nmExample.c.
| #define IDENTITY | ( | xmlname, | |
| txmsg, | |||
| rxmsg | |||
| ) |
Execute the pack, unpack identiy function.
| xmlname | XML name token |
| txmsg | Pre-packed, populated message structure. |
| rxmsg | Post-unacked, populated message structure. |
Definition at line 209 of file nmExample.c.
Referenced by tstCmdUniverse(), tstCmdZodiac(), and tstRspErr().
| #define PRCMP | ( | mem, | |
| fmt | |||
| ) |
Print side-by-side comparision of prepacked tx and post-unpacked rx member.
| mem | Structure member of txmsg and rxmsg. |
| fmt | Member print format. |
Definition at line 188 of file nmExample.c.
Referenced by tstCmdUniverse(), tstCmdZodiac(), and tstRspErr().
| typedef int(* tstfunc_t) () |
Test Function Type
Definition at line 248 of file nmExample.c.
| int Identity | ( | const char * | sXmlName, |
| Packer_T | fnPacker, | ||
| void * | pTxMsg, | ||
| Unpacker_T | fnUnpacker, | ||
| void * | pRxMsg | ||
| ) |
Execute the pack, unpack identiy function.
| sXmlName | XML name string |
| fnPacker | Packing function. |
| pTxMsg | Pointer to pre-packed, populated message structure. |
| fnUnpacker | Unpacking function. |
| pRxMsg | Pointer to post-unacked, message structure. |
Definition at line 227 of file nmExample.c.
References MSG_NS, and OptsTrace.
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Simple NetMsg example main.
| argc | Command-line argument count. |
| argv | Command-line argument list. |
Definition at line 464 of file nmExample.c.
References APP_EC_EXEC, APP_EC_OK, MainInit(), NM_OK, and TstTbl.
|
static |
Initialize simple_khr2 command.
Any command-line error immediately terminates application.
| argc | Command-line argument count. |
| argv | Command-line argument list. |
Definition at line 141 of file nmExample.c.
References APP_EC_OK, Argv0, OptsInfo, PgmInfo, and PkgInfo.
Referenced by main().
| int tstCmdUniverse | ( | ) |
Test CmdUniverse message packing and unpacking.
Definition at line 363 of file nmExample.c.
References IDENTITY, and PRCMP.
| int tstCmdZodiac | ( | ) |
Test CmdZodiac message packing and unpacking.
Definition at line 284 of file nmExample.c.
References ALPHA, BETA, DELTA, EPSILON, GAMMA, IDENTITY, and PRCMP.
| int tstRspErr | ( | ) |
Test AstroRspMsg message packing and unpacking.
Definition at line 257 of file nmExample.c.
References IDENTITY, and PRCMP.
|
static |
Command-line options information.
Definition at line 102 of file nmExample.c.
Referenced by MainInit().
|
static |
Program information.
Definition at line 88 of file nmExample.c.
Referenced by MainInit().
| tstfunc_t TstTbl[] |
Table of Test Functions.
Definition at line 447 of file nmExample.c.
Referenced by main().