packet_network_monitoring_project:pnpmtrace
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| packet_network_monitoring_project:pnpmtrace [2025/11/02 13:32] – [Executables] g8pzt | packet_network_monitoring_project:pnpmtrace [2025/11/02 16:20] (current) – removed g8pzt | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ===== PNMPTRACE - JSON to Packet Trace Converter for PNMP ===== | ||
| - | |||
| - | ==== What is PNMPTRACE? ==== | ||
| - | |||
| - | PNMPTRACE is a free open-source command line program which converts PNMP-format packet traces from JSON to a familiar ASCII " | ||
| - | |||
| - | ==== What is PNMP? ==== | ||
| - | |||
| - | PNMP is the [[packet: | ||
| - | |||
| - | The server, currently at ' | ||
| - | |||
| - | ==== Requirements ==== | ||
| - | |||
| - | * GCC if you want to compile the program from the source below, or from [[https:// | ||
| - | |||
| - | * mosquitto_sub (or any other suitable MQTT client). You can install this using 'sudo apt install mosquitto-clients' | ||
| - | |||
| - | ==== Executables ==== | ||
| - | |||
| - | The following executables have been compiled: | ||
| - | |||
| - | [[https:// | ||
| - | |||
| - | [[https:// | ||
| - | |||
| - | [[https:// | ||
| - | |||
| - | Or you may prefer to compile your own executable from the source below.. | ||
| - | ==== Notes ==== | ||
| - | |||
| - | This document assumes the use of Linux, and the MQTT client ' | ||
| - | |||
| - | ==== How to Compile PNMPTRACE ==== | ||
| - | |||
| - | * Copy and paste the C source code (below) into a file called pnmptrace.c | ||
| - | |||
| - | * Put pnmptrace.c into a directory of your choice. | ||
| - | |||
| - | * Open a terminal and change into that directory. | ||
| - | |||
| - | * Type: gcc -Wall -o " | ||
| - | |||
| - | * Type: " | ||
| - | |||
| - | You can leave the executable where it is, or move it to the /bin directory, which will allow it to be run from anywhere without prepending " | ||
| - | |||
| - | sudo mv pnmptrace /bin | ||
| - | |||
| - | ==== How To Use PNMPTRACE ==== | ||
| - | |||
| - | * Run mosquitto_sub, | ||
| - | |||
| - | mosquitto_sub -h node-api.packet.oarc.uk -t in/udp | ||
| - | |||
| - | * You should see a constant stream of JSON data. If so, you can stop mosquitto_sub and move to the next step. If you don't see any JSON, stop mosquitto_sub and re-check your command. | ||
| - | |||
| - | * Pipe the output of mosquitto_sub into PNMPTRACE like this: | ||
| - | |||
| - | mosquitto_sub -h node-api.packet.oarc.uk -t in/udp | ./pnmptrace | ||
| - | | ||
| - | (omit the " | ||
| - | |||
| - | You should now see the packet traces in a more familiar form. The exact format can be tweaked using various command line options, as detailed in the next section. | ||
| - | |||
| - | To read the MQTT from a file instead of mosquitto_sub, | ||
| - | |||
| - | cat mqtt.txt | ./pnmptrace | ||
| - | |||
| - | You may wish to apply some " | ||
| - | |||
| - | ==== Filters and Display Options ==== | ||
| - | |||
| - | These are specified as arguments to the program. They cannot be changed on the fly. | ||
| - | |||
| - | === Summary of Options === | ||
| - | |||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | -a < | ||
| - | | ||
| - | | ||
| - | -f < | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | -o < | ||
| - | -p < | ||
| - | -P < | ||
| - | | ||
| - | -r < | ||
| - | | ||
| - | -t < | ||
| - | -T < | ||
| - | | ||
| - | -w < | ||
| - | | ||
| - | |||
| - | More than one option can be specified, but some combinations are pointless. | ||
| - | |||
| - | === Display Options: === | ||
| - | |||
| - | < | ||
| - | | ||
| - | | ||
| - | -c | ||
| - | Don't colourise the traces. | ||
| - | according to whether the link is RF or internet, and whether | ||
| - | the direction is " | ||
| - | are displayed in pure red (transmit) or green (receive). | ||
| - | Internet-originated traces are displayed in pink (transmit) or | ||
| - | turquoise (receive). | ||
| - | |||
| - | -C | ||
| - | Include colour information in capture file. This is off by | ||
| - | default, and is ignored if the ' | ||
| - | Including colour information in the file allows it to be | ||
| - | played back in colour, but makes it harder to read with a text | ||
| - | editor. | ||
| - | |||
| - | -H | ||
| - | Show header (metadata) on a separate line to trace. | ||
| - | off by default, as most people seem to prefer "one line per | ||
| - | packet" | ||
| - | more information. | ||
| - | |||
| - | -j | ||
| - | Show the raw JSON prior to each trace. | ||
| - | If enabled, the JSON data for each trace is displayed first, | ||
| - | followed by the decoded trace. | ||
| - | |||
| - | -l | ||
| - | Suppress the blank line between traces. | ||
| - | Normally a blank line is output between each packet trace for | ||
| - | clarity. | ||
| - | hence this option. | ||
| - | |||
| - | -o < | ||
| - | Output the packet traces to < | ||
| - | that is displayed on screen is echoed to a capture file, whose | ||
| - | path/name is specified by this option. | ||
| - | " | ||
| - | suppressed using the ' | ||
| - | |||
| - | -q | ||
| - | Suppresses the display while capturing to file. | ||
| - | |||
| - | -s | ||
| - | Suppress the packet time stamp. | ||
| - | if prefixed with a time stamp of the form HH: | ||
| - | timestamps are generated by the reporting nodes, not by the | ||
| - | server, so there may be time differences between them. | ||
| - | |||
| - | -w < | ||
| - | Specify the display width (default 80 columns). | ||
| - | should fit within 80 columns, but INP3 traces which include | ||
| - | several INP3 options might exceed this width. | ||
| - | these are neatly line-wrapped to fit 80 columns. | ||
| - | wider display window you can specify the width using this | ||
| - | option. | ||
| - | width. | ||
| - | not narrower. | ||
| - | |||
| - | -W | ||
| - | Enable warnings of missing or bad JSON fields. | ||
| - | intended for debugging purposes. | ||
| - | |||
| - | </ | ||
| - | |||
| - | === Filter Options: === | ||
| - | |||
| - | < | ||
| - | -3 | ||
| - | Don't trace NetRom layer 3 or above. | ||
| - | specified, packets containing NetRom layer 3/4 information, | ||
| - | including NODES broadcasts and INP3 data, will end with | ||
| - | " | ||
| - | if for example you are only interested in the layer 2 data. | ||
| - | See also " | ||
| - | |||
| - | -4 | ||
| - | Don't trace NetRom layer 4 or above. | ||
| - | specified, NetRom layer 4 headers or protocol extensions are | ||
| - | not traced. | ||
| - | |||
| - | -a < | ||
| - | Show ALL frames to or from < | ||
| - | specified, ONLY those frames which have AX25 source or | ||
| - | destination callsigns matching < | ||
| - | can be used to watch all traffic into or out of a specific | ||
| - | node. | ||
| - | |||
| - | -f < | ||
| - | Show only frames addressed FROM < | ||
| - | specified, ONLY those frames whose AX25 source callsign matches | ||
| - | < | ||
| - | other options for even tighter filtering. | ||
| - | |||
| - | -i | ||
| - | Don't trace contents of INP3 routing unicasts. | ||
| - | can occupy a lot of space on screen. If you don't need to see | ||
| - | what they contain, the ' | ||
| - | all that is displayed is " | ||
| - | |||
| - | -k | ||
| - | Don't show L3RTT info field. | ||
| - | be up to 236 bytes, much of which is empty space. This wraps | ||
| - | untidily, so the ' | ||
| - | |||
| - | -n | ||
| - | Don't trace contents of NetRom ' | ||
| - | option is used, nodes broadcasts display only " | ||
| - | |||
| - | -p < | ||
| - | Show reports only from < | ||
| - | use in conjunction with the ' | ||
| - | For example, "r G8PZT -p 5" would show everything received or | ||
| - | sent on G8PZT' | ||
| - | |||
| - | -P < | ||
| - | Show only frames with the specified L3 protocol. For example | ||
| - | "-P IP" shows only IP over AX25 frames. | ||
| - | protocols are as f0llows: | ||
| - | |||
| - | Mnemonic | ||
| - | -------------------------------------------------------- | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | "?" | ||
| - | |||
| - | -r < | ||
| - | Show reports only from < | ||
| - | " | ||
| - | example "-r G8PZT" shows only the frames sent or overheard by | ||
| - | node G8PZT. | ||
| - | |||
| - | -t < | ||
| - | Show only frames addressed TO < | ||
| - | specified, ONLY those frames whose AX25 destination callsign | ||
| - | matches < | ||
| - | may be reported by more than one node. | ||
| - | |||
| - | -T < | ||
| - | Show only frames with the specified AX25 frametype. | ||
| - | "-T UI". The recognised frame types are as follows: | ||
| - | |||
| - | Mnemonic | ||
| - | --------------------------------------------------- | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | "?" | ||
| - | |||
| - | -u | ||
| - | Don't display UI frames. | ||
| - | don't want to see beacons, APRS data, or nodes broadcasts. | ||
| - | </ | ||
| - | |||
| - | Copyright (c) 2025 Paula Dowie | ||
| - | |||
| - | ==== Source Code ==== | ||
| - | <code c> | ||
| - | /* | ||
| - | * PNMPTRACE - A JSON to AX25 Packet Trace Decoder for the experimental | ||
| - | | ||
| - | * | ||
| - | * Copyright (C) 2025 Paula Dowie G8PZT. | ||
| - | * | ||
| - | * This program is free software: you can redistribute it and/or modify | ||
| - | * it under the terms of the GNU General Public License as published by | ||
| - | * the Free Software Foundation, either version 3 of the License, or | ||
| - | * (at your option) any later version. | ||
| - | * | ||
| - | * This program is distributed in the hope that it will be useful, | ||
| - | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| - | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| - | * GNU General Public License for more details. | ||
| - | * | ||
| - | * You should have received a copy of the GNU General Public License | ||
| - | * along with this program. | ||
| - | * < | ||
| - | * | ||
| - | | ||
| - | * | ||
| - | * Purpose: | ||
| - | * | ||
| - | | ||
| - | | ||
| - | * | ||
| - | | ||
| - | | ||
| - | * | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | * | ||
| - | | ||
| - | | ||
| - | * | ||
| - | * | ||
| - | * Usage: | ||
| - | * | ||
| - | | ||
| - | * | ||
| - | | ||
| - | * | ||
| - | * | ||
| - | * Examples: | ||
| - | * | ||
| - | | ||
| - | * | ||
| - | | ||
| - | * | ||
| - | * | ||
| - | * Limitations: | ||
| - | * | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | * | ||
| - | * | ||
| - | * Versions: | ||
| - | * | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | * | ||
| - | * To-Do: | ||
| - | * | ||
| - | | ||
| - | | ||
| - | | ||
| - | * | ||
| - | | ||
| - | * | ||
| - | | ||
| - | * | ||
| - | | ||
| - | * | ||
| - | | ||
| - | * | ||
| - | | ||
| - | | ||
| - | * | ||
| - | | ||
| - | | ||
| - | | ||
| - | * | ||
| - | * Notes: | ||
| - | * | ||
| - | | ||
| - | | ||
| - | | ||
| - | * | ||
| - | | ||
| - | | ||
| - | | ||
| - | * | ||
| - | | ||
| - | | ||
| - | * | ||
| - | | ||
| - | | ||
| - | * | ||
| - | | ||
| - | * | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | * */ | ||
| - | |||
| - | #define _GNU_SOURCE | ||
| - | |||
| - | #ifdef WIN32 | ||
| - | #include < | ||
| - | #include < | ||
| - | #define strcasestr StrStrI | ||
| - | #endif | ||
| - | |||
| - | #include < | ||
| - | #include < | ||
| - | #include < | ||
| - | #include < | ||
| - | #include < | ||
| - | #include < | ||
| - | #include < | ||
| - | #include < | ||
| - | |||
| - | static char VERSION[] = " | ||
| - | static char Margin[] = " | ||
| - | |||
| - | /* If filters are populated, they restrict the display to frames whose | ||
| - | * fields match the filters. Unpopulated filters have no effect. The | ||
| - | * compiler should set all these to null strings | ||
| - | * */ | ||
| - | static char ReportFilter [16]; // Callsign to accept reports from | ||
| - | static char SrcFilter [16]; // Source callsign filter | ||
| - | static char DstFilter [16]; // Destination callsign filter | ||
| - | static char AllFilter [16]; // Callsign to filter to/from | ||
| - | static char ProtoFilter [16]; // Protocol to filter by | ||
| - | static char TypeFilter [16]; // For filtering by L2Type | ||
| - | static int PortFilter = 0; // For filtering by port number | ||
| - | static int DisplayWidth = 80; | ||
| - | |||
| - | // TraceFlags control display options & filters | ||
| - | static int TraceFlags = 0x7ff; | ||
| - | |||
| - | # | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | # | ||
| - | |||
| - | static char CaptureFile [256]; | ||
| - | static FILE *FpCapture = NULL; // For capturing output to file | ||
| - | |||
| - | |||
| - | //###################################################################### | ||
| - | // JSON FUNCTIONS | ||
| - | //###################################################################### | ||
| - | |||
| - | / | ||
| - | /* Purpose: | ||
| - | * Called by: json_findArray() and json_getValue() | ||
| - | * Arguments: | ||
| - | * Actions: | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | * Affects: | ||
| - | * Returns: | ||
| - | | ||
| - | * Notes: | ||
| - | * Created: | ||
| - | * Modified: | ||
| - | / | ||
| - | |||
| - | static char *json_findObject (const char *json, const char *name) | ||
| - | { | ||
| - | | ||
| - | |||
| - | | ||
| - | |||
| - | if ((cp = strcasestr (json, tmp)) == NULL) | ||
| - | return (NULL); // Name not found | ||
| - | |||
| - | cp++; // Skip opening quote of the name | ||
| - | |||
| - | while (*cp && *cp != '"' | ||
| - | |||
| - | while (*cp && *cp != ':' | ||
| - | |||
| - | if (*cp != ':' | ||
| - | |||
| - | cp++; // skip the colon | ||
| - | |||
| - | while (isspace (*cp)) cp++; // Skip space after colon | ||
| - | |||
| - | | ||
| - | } | ||
| - | |||
| - | / | ||
| - | /* Purpose: | ||
| - | * Called by: trace_nodes() and trace_inp3(). | ||
| - | * Arguments: | ||
| - | * Actions: | ||
| - | | ||
| - | | ||
| - | * Affects: | ||
| - | * Returns: | ||
| - | | ||
| - | * Notes: | ||
| - | * Created: | ||
| - | * Modified: | ||
| - | / | ||
| - | |||
| - | static char *json_findArray (const char *json, char *name) | ||
| - | { | ||
| - | | ||
| - | |||
| - | if ((cp = json_findObject (json, name)) == NULL) return (NULL); | ||
| - | |||
| - | if (*cp != ' | ||
| - | |||
| - | | ||
| - | } | ||
| - | |||
| - | / | ||
| - | /* Purpose: | ||
| - | * Called by: Many places! | ||
| - | * Arguments: | ||
| - | | ||
| - | | ||
| - | * Actions: | ||
| - | | ||
| - | | ||
| - | * Affects: | ||
| - | * Returns: | ||
| - | | ||
| - | * Notes: | ||
| - | * Created: | ||
| - | * Modified: | ||
| - | / | ||
| - | |||
| - | static char *json_getValue (const char *json, const char *name, | ||
| - | char *result, int maxlen) | ||
| - | { | ||
| - | | ||
| - | | ||
| - | |||
| - | if ((cp = json_findObject (json, name)) == NULL) | ||
| - | return (NULL); // Name not found | ||
| - | |||
| - | if (*cp == '"' | ||
| - | { | ||
| - | string = 1; // it's a string literal. | ||
| - | cp++; // Skip the quote character to point at value | ||
| - | } | ||
| - | |||
| - | if (string) | ||
| - | { | ||
| - | while (*cp && *cp != '"' | ||
| - | { | ||
| - | if (maxlen-- > 0) *result++ = *cp; | ||
| - | cp++; | ||
| - | } | ||
| - | } | ||
| - | | ||
| - | { | ||
| - | // Copy the value to " | ||
| - | while (*cp && (*cp == ' | ||
| - | { | ||
| - | if (maxlen-- > 0) *result++ = *cp; | ||
| - | cp++; | ||
| - | } | ||
| - | } | ||
| - | |||
| - | | ||
| - | |||
| - | | ||
| - | } | ||
| - | |||
| - | / | ||
| - | /* Purpose: | ||
| - | * Called by: trace_inp3() only. Ought to be used by decde_nodes()! | ||
| - | * Arguments: | ||
| - | | ||
| - | | ||
| - | * Actions: | ||
| - | | ||
| - | | ||
| - | * Affects: | ||
| - | * Returns: | ||
| - | | ||
| - | * Notes: | ||
| - | | ||
| - | * Created: | ||
| - | * Modified: | ||
| - | / | ||
| - | |||
| - | static const char *json_getNextArrayElement (const char *json, | ||
| - | char *buffer, int maxlen) | ||
| - | { | ||
| - | const char *cp = json; | ||
| - | |||
| - | // Find end of current element | ||
| - | while (*cp && *cp != ' | ||
| - | |||
| - | if (*cp != ' | ||
| - | |||
| - | // Find start of next element | ||
| - | while (*cp && *cp != ' | ||
| - | |||
| - | if (*cp != ' | ||
| - | |||
| - | json = cp; // Remember pointer to start of element | ||
| - | |||
| - | // Copy up to " | ||
| - | while (*cp && maxlen-- > 0) | ||
| - | { | ||
| - | *buffer++ = *cp; | ||
| - | if (*cp == ' | ||
| - | cp++; | ||
| - | } | ||
| - | | ||
| - | |||
| - | | ||
| - | } | ||
| - | |||
| - | |||
| - | |||
| - | //###################################################################### | ||
| - | // | ||
| - | //###################################################################### | ||
| - | |||
| - | / | ||
| - | /* Purpose: | ||
| - | * Called by: Most functions. | ||
| - | * Arguments: | ||
| - | * Actions: | ||
| - | | ||
| - | * Affects: | ||
| - | * Returns: | ||
| - | * Notes: | ||
| - | | ||
| - | | ||
| - | * Created: | ||
| - | * Modified: | ||
| - | / | ||
| - | |||
| - | static int uprintf (char *fmt, ...) | ||
| - | { | ||
| - | char buff [4096]; | ||
| - | | ||
| - | |||
| - | | ||
| - | | ||
| - | | ||
| - | |||
| - | // Output to capture file if it is open | ||
| - | if (FpCapture) | ||
| - | { | ||
| - | fputs (buff, FpCapture); | ||
| - | fflush (FpCapture); | ||
| - | } | ||
| - | |||
| - | // Output to stdio if not in " | ||
| - | if ((TraceFlags & TRACE_QUIET) == 0) fputs (buff, stdout); | ||
| - | |||
| - | | ||
| - | } | ||
| - | |||
| - | |||
| - | / | ||
| - | /* Purpose: | ||
| - | * Called by: trace_netromRoutingInfo() only. | ||
| - | * Arguments: | ||
| - | * Actions: | ||
| - | | ||
| - | | ||
| - | * Affects: | ||
| - | * Returns: | ||
| - | * Notes: | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | * Created: | ||
| - | * Modified: | ||
| - | / | ||
| - | |||
| - | static void trace_nodes (const char *json) | ||
| - | { | ||
| - | | ||
| - | |||
| - | if ((TraceFlags & TRACE_NODES) == 0) | ||
| - | { | ||
| - | uprintf (" NODES Broadcast" | ||
| - | return; // Not wanted | ||
| - | } | ||
| - | |||
| - | if ((cp = json_getValue (json, " | ||
| - | { | ||
| - | if (TraceFlags & TRACE_WARNINGS) | ||
| - | | ||
| - | return; | ||
| - | } | ||
| - | |||
| - | | ||
| - | |||
| - | if ((cp = json_findArray (cp, " | ||
| - | { | ||
| - | if (TraceFlags & TRACE_WARNINGS) | ||
| - | | ||
| - | return; | ||
| - | } | ||
| - | |||
| - | // cp is pointing at the opening square bracket of nodes array | ||
| - | while (*cp) | ||
| - | { | ||
| - | // Format is " | ||
| - | if (json_getValue (cp, " | ||
| - | | ||
| - | |||
| - | if (json_getValue (cp, " | ||
| - | | ||
| - | |||
| - | if (json_getValue (cp, " | ||
| - | | ||
| - | |||
| - | if (json_getValue (cp, " | ||
| - | | ||
| - | |||
| - | while (*cp && *cp != ' | ||
| - | if (*cp) cp++; | ||
| - | } | ||
| - | } | ||
| - | |||
| - | static int wrap (void) | ||
| - | { | ||
| - | | ||
| - | | ||
| - | } | ||
| - | |||
| - | / | ||
| - | /* Purpose: | ||
| - | * Called by: trace_netromRoutingInfo() only. | ||
| - | * Arguments: | ||
| - | * Actions: | ||
| - | | ||
| - | * Affects: | ||
| - | * Returns: | ||
| - | * Notes: | ||
| - | * Created: | ||
| - | * Modified: | ||
| - | / | ||
| - | |||
| - | static void trace_inp3 (const char *json) | ||
| - | { | ||
| - | | ||
| - | const char *cp; | ||
| - | |||
| - | if ((TraceFlags & TRACE_INP3) == 0) | ||
| - | { | ||
| - | uprintf (" INP3" | ||
| - | return; | ||
| - | } | ||
| - | |||
| - | | ||
| - | |||
| - | if ((cp = json_findArray (json, " | ||
| - | { | ||
| - | if (TraceFlags & TRACE_WARNINGS) | ||
| - | | ||
| - | return; | ||
| - | } | ||
| - | |||
| - | // cp is now pointing at the opening square bracket of nodes array | ||
| - | |||
| - | while ((cp = json_getNextArrayElement (cp, object, 1023)) != NULL) | ||
| - | { | ||
| - | int cols = 0; | ||
| - | |||
| - | // Minimum format is " | ||
| - | |||
| - | if (json_getValue (object, " | ||
| - | cols += uprintf (" | ||
| - | |||
| - | if (json_getValue (object, " | ||
| - | cols += uprintf (" | ||
| - | |||
| - | if (json_getValue (object, " | ||
| - | cols += uprintf (" | ||
| - | |||
| - | // Optional fields | ||
| - | // " | ||
| - | |||
| - | if (json_getValue (object, " | ||
| - | cols += uprintf (" | ||
| - | |||
| - | if (json_getValue (object, " | ||
| - | cols += uprintf (" %s", tmp); | ||
| - | |||
| - | if (json_getValue (object, " | ||
| - | cols += uprintf (" %s", tmp); | ||
| - | |||
| - | if (json_getValue (object, " | ||
| - | cols += uprintf (" S/ | ||
| - | |||
| - | // If could overflow 80-col line after this point | ||
| - | |||
| - | if (json_getValue (object, " | ||
| - | { | ||
| - | if (cols+2+strlen (tmp) >= DisplayWidth) cols = wrap (); | ||
| - | cols += uprintf (" v%s", tmp); | ||
| - | } | ||
| - | |||
| - | if (json_getValue (object, " | ||
| - | && strcmp (tmp, " | ||
| - | { | ||
| - | if ((cols + 5) >= DisplayWidth) cols = wrap (); | ||
| - | cols += uprintf (" NODE" | ||
| - | } | ||
| - | |||
| - | if (json_getValue (object, " | ||
| - | && strcmp (tmp, " | ||
| - | { | ||
| - | if ((cols + 4) >= DisplayWidth) cols= wrap (); | ||
| - | cols += uprintf (" BBS"); | ||
| - | } | ||
| - | |||
| - | if (json_getValue (object, " | ||
| - | && strcmp (tmp, " | ||
| - | { | ||
| - | if ((cols + 4) >= DisplayWidth) cols= wrap (); | ||
| - | cols += uprintf (" PMS"); | ||
| - | } | ||
| - | |||
| - | if (json_getValue (object, " | ||
| - | && strcmp (tmp, " | ||
| - | { | ||
| - | if ((cols + 7) >= DisplayWidth) cols = wrap (); | ||
| - | cols += uprintf (" XRCHAT" | ||
| - | } | ||
| - | |||
| - | if (json_getValue (object, " | ||
| - | && strcmp (tmp, " | ||
| - | { | ||
| - | if ((cols + 7) >= DisplayWidth) cols = wrap (); | ||
| - | cols += uprintf (" RTCHAT" | ||
| - | } | ||
| - | |||
| - | if (json_getValue (object, " | ||
| - | && strcmp (tmp, " | ||
| - | { | ||
| - | if ((cols + 4) >= DisplayWidth) cols = wrap (); | ||
| - | cols += uprintf (" RMS"); | ||
| - | } | ||
| - | |||
| - | if (json_getValue (object, " | ||
| - | && strcmp (tmp, " | ||
| - | { | ||
| - | if ((cols + 7) >= DisplayWidth) cols= wrap (); | ||
| - | cols += uprintf (" DXCLUS" | ||
| - | } | ||
| - | |||
| - | if (json_getValue (object, " | ||
| - | { | ||
| - | // There are two typs of timestamps currently in use... | ||
| - | if (strchr (tmp, ' | ||
| - | { | ||
| - | // 2025-10-24T12: | ||
| - | if ((cols + 21) >= DisplayWidth) cols= wrap (); | ||
| - | cols += uprintf (" %s", tmp); | ||
| - | } | ||
| - | |||
| - | | ||
| - | { | ||
| - | time_t | ||
| - | |||
| - | if (((unsigned)t) > 18000) | ||
| - | { | ||
| - | | ||
| - | if ((cols + 12) >= DisplayWidth) cols= wrap (); | ||
| - | cols += uprintf (" %02d/%02d %02d: | ||
| - | tim-> | ||
| - | tim-> | ||
| - | } | ||
| - | } | ||
| - | } | ||
| - | |||
| - | if (json_getValue (object, " | ||
| - | { | ||
| - | if (cols+3+strlen (tmp) >= DisplayWidth) cols = wrap (); | ||
| - | | ||
| - | } | ||
| - | } | ||
| - | } | ||
| - | |||
| - | / | ||
| - | /* Purpose: | ||
| - | * Called by: process_json() for ptcl=" | ||
| - | * Arguments: | ||
| - | * Returns: | ||
| - | * Created: | ||
| - | * Modified: | ||
| - | / | ||
| - | |||
| - | static void trace_arp (const char *json) | ||
| - | { | ||
| - | | ||
| - | |||
| - | if ((TraceFlags & TRACE_ARP) == 0) return; | ||
| - | |||
| - | // Older software doesn' | ||
| - | if (json_getValue (json, " | ||
| - | |||
| - | | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | uprintf (" hwtype=%s", | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | uprintf (" hwlen=%s", | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | uprintf (" prot=%s", | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | uprintf (" | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | uprintf (" tgt=%s", | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | uprintf (" snd_hw=%s", | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | uprintf (" tgt_hw=%s", | ||
| - | } | ||
| - | |||
| - | / | ||
| - | /* Purpose: | ||
| - | * Called by: process_json() for ptcl=" | ||
| - | * Arguments: | ||
| - | * Actions: | ||
| - | * Affects: | ||
| - | * Returns: | ||
| - | * Created: | ||
| - | * Modified: | ||
| - | / | ||
| - | |||
| - | static void trace_ip (const char *json) | ||
| - | { | ||
| - | | ||
| - | |||
| - | if ((TraceFlags & TRACE_IP) == 0) return; | ||
| - | |||
| - | // Older software doesn' | ||
| - | if (json_getValue (json, " | ||
| - | || json_getValue (json, " | ||
| - | return; | ||
| - | |||
| - | // IP: 44.136.16.50 > 44.136.16.52 iplen=28 ttl=127 id=ABA0 ptcl=1 ICMP | ||
| - | | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | } | ||
| - | |||
| - | / | ||
| - | /* Purpose: | ||
| - | * Called by: trace_netrom() only. | ||
| - | * Arguments: | ||
| - | * Actions: | ||
| - | | ||
| - | * Returns: | ||
| - | * Created: | ||
| - | * Modified: | ||
| - | / | ||
| - | |||
| - | static void trace_netromRoutingInfo (const char *json) | ||
| - | { | ||
| - | | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | { | ||
| - | if (TraceFlags & TRACE_WARNINGS) | ||
| - | | ||
| - | return; | ||
| - | } | ||
| - | |||
| - | if (strcmp (type, " | ||
| - | |||
| - | else if (strcmp (type, " | ||
| - | |||
| - | else if (TraceFlags & TRACE_WARNINGS) | ||
| - | uprintf (" [unknown ' | ||
| - | |||
| - | // Future types go here | ||
| - | } | ||
| - | |||
| - | / | ||
| - | /* Purpose: | ||
| - | * Called by: x | ||
| - | * Arguments: | ||
| - | * Actions: | ||
| - | * Affects: | ||
| - | * Returns: | ||
| - | * Notes: | ||
| - | * Created: | ||
| - | * Modified: | ||
| - | / | ||
| - | |||
| - | static void trace_netromRoutingPoll (const char *json) | ||
| - | { | ||
| - | /// TODO: Populate me | ||
| - | } | ||
| - | |||
| - | / | ||
| - | /* Purpose: | ||
| - | * Called by: trace_netromL3() only | ||
| - | * Arguments: | ||
| - | * Actions: | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | * Affects: | ||
| - | * Returns: | ||
| - | * Notes: | ||
| - | * Created: | ||
| - | * Modified: | ||
| - | / | ||
| - | |||
| - | static void trace_netromL4 (const char *json) | ||
| - | { | ||
| - | | ||
| - | |||
| - | if ((TraceFlags & TRACE_L4) == 0) return; | ||
| - | |||
| - | // | ||
| - | if (json_getValue (json, " | ||
| - | { | ||
| - | if (TraceFlags & TRACE_WARNINGS) | ||
| - | | ||
| - | return; | ||
| - | } | ||
| - | |||
| - | if (strcmp (l4type, " | ||
| - | { | ||
| - | if (TraceFlags & TRACE_WARNINGS) | ||
| - | | ||
| - | return; | ||
| - | } | ||
| - | |||
| - | if (strcmp (l4type, "PROT EXT") == 0) | ||
| - | { | ||
| - | uprintf (" < | ||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | return; | ||
| - | } | ||
| - | |||
| - | if (strcmp (l4type, " | ||
| - | || strcmp (l4type, " | ||
| - | || strcmp (l4type, " | ||
| - | || strcmp (l4type, " | ||
| - | { | ||
| - | /// TODO: Decode these properly one day | ||
| - | uprintf (" < | ||
| - | return; | ||
| - | } | ||
| - | |||
| - | if (strcmp (l4type, "NRR Request" | ||
| - | || strcmp (l4type, "NRR Reply" | ||
| - | { | ||
| - | uprintf (" < | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | return; | ||
| - | } | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | uprintf (" cct=%s", | ||
| - | |||
| - | if (strcmp (l4type, "CONN REQ") == 0 | ||
| - | || strcmp (l4type, " | ||
| - | { | ||
| - | uprintf (" < | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | else return; | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | |||
| - | return; | ||
| - | } | ||
| - | |||
| - | if (strcmp (l4type, "CONN ACK") == 0) | ||
| - | { | ||
| - | uprintf (" < | ||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | return; // ?? | ||
| - | } | ||
| - | |||
| - | if (strcmp (l4type, "CONN NAK") == 0) | ||
| - | { | ||
| - | uprintf (" < | ||
| - | return; // ?? | ||
| - | } | ||
| - | |||
| - | if (strcmp (l4type, " | ||
| - | || strcmp (l4type, " | ||
| - | { | ||
| - | uprintf (" < | ||
| - | return; | ||
| - | } | ||
| - | |||
| - | if (strcmp (l4type, " | ||
| - | { | ||
| - | uprintf (" < | ||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | return; | ||
| - | } | ||
| - | |||
| - | if (strcmp (l4type, " | ||
| - | { | ||
| - | uprintf (" < | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | |||
| - | uprintf (">" | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | } | ||
| - | |||
| - | else if (strcmp (l4type, "INFO ACK") == 0) | ||
| - | { | ||
| - | uprintf (" < | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | |||
| - | uprintf (">" | ||
| - | } | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | |||
| - | } | ||
| - | |||
| - | / | ||
| - | /* Purpose: | ||
| - | * Called by: trace_netromL3() if l3Dest is " | ||
| - | * Arguments: | ||
| - | * Notes: | ||
| - | | ||
| - | | ||
| - | | ||
| - | * Created: | ||
| - | * Modified: | ||
| - | / | ||
| - | |||
| - | static void trace_l3rtt (const char *json) | ||
| - | { | ||
| - | | ||
| - | |||
| - | /* " | ||
| - | * be 0, if you want to bother to check them | ||
| - | * */ | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | |||
| - | if ((TraceFlags & TRACE_L3RTT) == 0) return; | ||
| - | |||
| - | // Payload chan be up to 236 chara, so it will wrap untidily | ||
| - | /// TODO: parse the payload & present the fields in a neater form | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | uprintf (": | ||
| - | } | ||
| - | |||
| - | |||
| - | / | ||
| - | /* Purpose: | ||
| - | * Called by: trace_netrom() if l3Type is " | ||
| - | * Arguments: | ||
| - | * Actions: | ||
| - | | ||
| - | * Affects: | ||
| - | * Returns: | ||
| - | * Created: | ||
| - | * Modified: | ||
| - | / | ||
| - | |||
| - | static void trace_netromL3 (const char *json) | ||
| - | { | ||
| - | char tmp [16]; | ||
| - | | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | uprintf (" | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | uprintf (" to %s", tmp); // layer 3 dest | ||
| - | |||
| - | | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | uprintf (" ttl=%s", | ||
| - | |||
| - | if (isL3RTT) trace_l3rtt (json); | ||
| - | else trace_netromL4 (json); | ||
| - | } | ||
| - | |||
| - | / | ||
| - | /* Purpose: | ||
| - | * Called by: process_json() only. | ||
| - | * Arguments: | ||
| - | * Actions: | ||
| - | * Affects: | ||
| - | * Returns: | ||
| - | * Created: | ||
| - | / | ||
| - | |||
| - | static void trace_netrom (const char *json) | ||
| - | { | ||
| - | | ||
| - | |||
| - | if ((TraceFlags & TRACE_NETROM) == 0) return; | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | { | ||
| - | if (TraceFlags & TRACE_WARNINGS) | ||
| - | | ||
| - | return; | ||
| - | } | ||
| - | |||
| - | if (strcmp (tmp, " | ||
| - | |||
| - | else if (strcmp (tmp, " | ||
| - | trace_netromRoutingInfo (json); | ||
| - | |||
| - | else if (strcmp (tmp, " | ||
| - | trace_netromRoutingPoll (json); | ||
| - | |||
| - | else if (TraceFlags & TRACE_WARNINGS) | ||
| - | uprintf (" [unknown ' | ||
| - | } | ||
| - | |||
| - | / | ||
| - | /* Purpose: | ||
| - | * Called by: main() only. | ||
| - | * Arguments: | ||
| - | * Actions: | ||
| - | | ||
| - | | ||
| - | * Affects: | ||
| - | * Returns: | ||
| - | * Created: | ||
| - | * Modified: | ||
| - | / | ||
| - | |||
| - | static void process_json (const char *json) | ||
| - | { | ||
| - | | ||
| - | | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | { | ||
| - | if (TraceFlags & TRACE_WARNINGS) | ||
| - | | ||
| - | return; | ||
| - | } | ||
| - | |||
| - | /// TODO: Test for and process other report types here if desired | ||
| - | if (strcmp (tmp, " | ||
| - | |||
| - | // Extract some mandatory fields | ||
| - | if (json_getValue (json, " | ||
| - | || json_getValue (json, " | ||
| - | || json_getValue (json, " | ||
| - | || json_getValue (json, " | ||
| - | || json_getValue (json, " | ||
| - | { | ||
| - | if (TraceFlags & TRACE_WARNINGS) | ||
| - | | ||
| - | return; | ||
| - | } | ||
| - | |||
| - | // Extract some of the optional values. | ||
| - | if (json_getValue (json, " | ||
| - | if (json_getValue (json, " | ||
| - | if (json_getValue (json, " | ||
| - | |||
| - | if (strcmp (l2type, " | ||
| - | && | ||
| - | return; | ||
| - | |||
| - | // Filter by reporting node | ||
| - | if (*ReportFilter // If report filter is enabled | ||
| - | && | ||
| - | return; | ||
| - | |||
| - | // Filter by node's port number | ||
| - | if (PortFilter && atoi (portnum) != PortFilter) return; | ||
| - | |||
| - | // Filter by packet type | ||
| - | if (*TypeFilter | ||
| - | && | ||
| - | return; | ||
| - | |||
| - | // Filter by AX25 source call | ||
| - | if (*SrcFilter | ||
| - | && | ||
| - | return; | ||
| - | |||
| - | // Filter by AX25 source and destination calls | ||
| - | if (*DstFilter | ||
| - | && | ||
| - | return; | ||
| - | |||
| - | // Filter by either AX25 source or destination call | ||
| - | if (*AllFilter | ||
| - | && | ||
| - | && | ||
| - | return; | ||
| - | |||
| - | // Filter by protocol ID | ||
| - | if (*ProtoFilter | ||
| - | && | ||
| - | return; | ||
| - | |||
| - | |||
| - | if (TraceFlags & TRACE_COLOR) | ||
| - | { | ||
| - | const char *colorstr; | ||
| - | |||
| - | if (*isRF == ' | ||
| - | { | ||
| - | | ||
| - | { | ||
| - | case ' | ||
| - | case ' | ||
| - | default: | ||
| - | } | ||
| - | } | ||
| - | |||
| - | else if (*isRF == ' | ||
| - | { | ||
| - | | ||
| - | { | ||
| - | case ' | ||
| - | case ' | ||
| - | default: | ||
| - | } | ||
| - | } | ||
| - | |||
| - | else // Unknown RF/Inet status | ||
| - | | ||
| - | |||
| - | /* Sending colour information to capture file allows it to be | ||
| - | * played back in colour but makes it difficult to read with a | ||
| - | * text editor. Therefore it is turned off by default. | ||
| - | * */ | ||
| - | if (TraceFlags & TRACE_COLOR2FILE) uprintf (" | ||
| - | else printf (" | ||
| - | } | ||
| - | |||
| - | // If raw JSON wanted, print it before the trace (defaults off) | ||
| - | if (TraceFlags & TRACE_JSON) uprintf (" | ||
| - | |||
| - | // Print a blank line between traces (dedaults on) | ||
| - | if (TraceFlags & TRACE_LBRK) uprintf (" | ||
| - | |||
| - | // If timestamp is wanted (defaults on) | ||
| - | if (TraceFlags & TRACE_STAMP) | ||
| - | { | ||
| - | struct tm *tp; | ||
| - | time_t | ||
| - | |||
| - | if (json_getValue (json, " | ||
| - | else t = time (NULL); | ||
| - | |||
| - | tp = gmtime (&t); | ||
| - | |||
| - | uprintf (" | ||
| - | | ||
| - | } | ||
| - | |||
| - | if (TraceFlags & TRACE_HDRLIN) | ||
| - | { | ||
| - | // Metadata and trace on separate lines for clarity | ||
| - | uprintf ("%s port %s", reporter, portnum); | ||
| - | if (*isRF) uprintf (*isRF == ' | ||
| - | if (*dirn) uprintf (" %s", dirn); | ||
| - | uprintf (": | ||
| - | } | ||
| - | else // Metadata and trace on one messy line | ||
| - | { | ||
| - | sprintf (tmp, " | ||
| - | | ||
| - | |||
| - | uprintf ("%s ", tmp); | ||
| - | } | ||
| - | |||
| - | // Display L2 source, destination and type | ||
| - | | ||
| - | |||
| - | // The format of these varies with frame type... | ||
| - | if (json_getValue (json, " | ||
| - | if (json_getValue (json, " | ||
| - | if (json_getValue (json, " | ||
| - | if (json_getValue (json, " | ||
| - | | ||
| - | |||
| - | // Display info field length and pid if present | ||
| - | if (json_getValue (json, " | ||
| - | if (json_getValue (json, " | ||
| - | if (*ptcl) uprintf (" %s", ptcl); | ||
| - | |||
| - | // Decode some payloads | ||
| - | if (*ptcl) | ||
| - | { | ||
| - | if (strcmp (ptcl, " | ||
| - | |||
| - | else if (strcmp (ptcl, " | ||
| - | { | ||
| - | // The " | ||
| - | if (json_getValue (json, " | ||
| - | uprintf (": | ||
| - | |||
| - | // The " | ||
| - | else if (json_getValue (json, " | ||
| - | uprintf (" CRC=%s", | ||
| - | } | ||
| - | |||
| - | else if (strcmp (ptcl, " | ||
| - | |||
| - | else if (strcmp (ptcl, " | ||
| - | /// TODO: Add flexnet | ||
| - | } | ||
| - | |||
| - | | ||
| - | } | ||
| - | |||
| - | / | ||
| - | /* Purpose: | ||
| - | * Called by: main() if " | ||
| - | * Created: | ||
| - | * Modified: | ||
| - | / | ||
| - | |||
| - | static void showHelp (void) | ||
| - | { | ||
| - | | ||
| - | |||
| - | | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | } | ||
| - | |||
| - | / | ||
| - | /* Purpose: | ||
| - | * Called by: From command line | ||
| - | * Arguments: | ||
| - | * Actions: | ||
| - | | ||
| - | | ||
| - | * Returns: | ||
| - | * Notes: | ||
| - | * Created: | ||
| - | * Modified: | ||
| - | / | ||
| - | |||
| - | int main (int argc, char *argv[]) | ||
| - | { | ||
| - | | ||
| - | | ||
| - | | ||
| - | |||
| - | | ||
| - | | ||
| - | if (argc < 2) uprintf ("Use ' | ||
| - | " | ||
| - | |||
| - | while (1) | ||
| - | { | ||
| - | if ((c = getopt (argc, argv, " | ||
| - | | ||
| - | |||
| - | switch (c) | ||
| - | { | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | case ' | ||
| - | } | ||
| - | } | ||
| - | |||
| - | if (*CaptureFile) | ||
| - | { | ||
| - | if ((FpCapture = fopen (CaptureFile, | ||
| - | { | ||
| - | | ||
| - | | ||
| - | } | ||
| - | printf (" | ||
| - | } | ||
| - | |||
| - | if (*ReportFilter) | ||
| - | uprintf (" | ||
| - | |||
| - | if (PortFilter) | ||
| - | uprintf (" | ||
| - | | ||
| - | |||
| - | if (*SrcFilter) | ||
| - | uprintf (" | ||
| - | | ||
| - | |||
| - | if (*DstFilter) | ||
| - | uprintf (" | ||
| - | | ||
| - | |||
| - | if (*AllFilter) | ||
| - | uprintf (" | ||
| - | |||
| - | if (*TypeFilter) | ||
| - | uprintf (" | ||
| - | |||
| - | if (*ProtoFilter) | ||
| - | uprintf (" | ||
| - | | ||
| - | |||
| - | if ((TraceFlags & TRACE_UI) == 0) uprintf ("Not showing UI frames\n" | ||
| - | |||
| - | if ((TraceFlags & TRACE_NETROM) == 0) | ||
| - | uprintf ("Not decoding NODES broadcasts\n" | ||
| - | |||
| - | if ((TraceFlags & TRACE_INP3) == 0) | ||
| - | uprintf ("Not decoding INP3 unicasts\n" | ||
| - | |||
| - | if ((TraceFlags & TRACE_NETROM) == 0) | ||
| - | uprintf ("Not decoding NetRom Layer 3 or above\n" | ||
| - | |||
| - | if ((TraceFlags & TRACE_L4) == 0) | ||
| - | uprintf ("Not decoding NetRom Layer 4 or above\n" | ||
| - | |||
| - | if ((TraceFlags & TRACE_L3RTT) == 0) | ||
| - | uprintf ("Not showing L3RTT frame contents\n" | ||
| - | |||
| - | if (TraceFlags & TRACE_JSON) uprintf (" | ||
| - | |||
| - | if ((TraceFlags & TRACE_STAMP) == 0) | ||
| - | uprintf ("Time stamp disabled\n" | ||
| - | |||
| - | cp = buffer; | ||
| - | |||
| - | while (1) // Forever loop | ||
| - | { | ||
| - | // Get a char from stdin - blocking | ||
| - | if ((ch = getchar ()) == EOF) break; | ||
| - | |||
| - | if (braceLevel == 0) // Waiting for opening brace | ||
| - | { | ||
| - | if (ch == ' | ||
| - | { | ||
| - | braceLevel = 1; | ||
| - | cp = buffer; | ||
| - | } | ||
| - | | ||
| - | } | ||
| - | |||
| - | // If we get here, braceLevel is > 0 | ||
| - | |||
| - | if (ch == ' | ||
| - | { | ||
| - | if (!escaped | ||
| - | && | ||
| - | && | ||
| - | { | ||
| - | *cp++ = 0; // Terminate the string | ||
| - | process_json (buffer); | ||
| - | cp = buffer; | ||
| - | continue; | ||
| - | } | ||
| - | } | ||
| - | |||
| - | *cp++ = ch; // Copy the character to the object buffer | ||
| - | |||
| - | if (ch == ' | ||
| - | && !escaped && !inString) | ||
| - | { | ||
| - | | ||
| - | | ||
| - | } | ||
| - | |||
| - | if (escaped) | ||
| - | { | ||
| - | | ||
| - | | ||
| - | } | ||
| - | else // Not in escaped mode | ||
| - | { | ||
| - | if (ch == ' | ||
| - | { | ||
| - | escaped = 1; // Set escaped mode | ||
| - | continue; | ||
| - | } | ||
| - | } | ||
| - | |||
| - | // Not escape and not ' | ||
| - | |||
| - | if (ch == '"' | ||
| - | { | ||
| - | if (inString) inString = 0; | ||
| - | else inString = 1; | ||
| - | | ||
| - | } | ||
| - | |||
| - | } // end of while() | ||
| - | |||
| - | if (FpCapture) fclose (FpCapture); | ||
| - | |||
| - | | ||
| - | } | ||
| - | |||
| - | </ | ||
| - | |||
packet_network_monitoring_project/pnpmtrace.1762090366.txt.gz · Last modified: by g8pzt
