123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- #ifndef TOPOLOGYPRINT_SOURCE
- #define TOPOLOGYPRINT_SOURCE
- #include <stdio.h>
- #include "../plc/plc.h"
- #include "../tools/memory.h"
- signed PLCTopologyPrint (struct plctopology * plctopology)
- {
- signed plcnetworks = plctopology->plcnetworks;
- struct plcnetwork * plcnetwork = (struct plcnetwork *)(&plctopology->plcnetwork);
- while (plcnetworks--)
- {
- signed plcstations = plcnetwork->plcstations;
- struct plcstation * plcstation = (struct plcstation *)(&plcnetwork->plcstation);
- while (plcstations--)
- {
- char address [ETHER_ADDR_LEN * 3];
- printf ("%s ", plcstation->LOC? "LOC": "REM");
- printf ("%s ", plcstation->CCO? "CCO": "STA");
- printf ("%03d ", plcstation->TEI);
- printf ("%s ", hexstring (address, sizeof (address), plcstation->MAC, sizeof (plcstation->MAC)));
- printf ("%s ", hexstring (address, sizeof (address), plcstation->BDA, sizeof (plcstation->BDA)));
- printf ("%03d ", plcstation->RX);
- printf ("%03d ", plcstation->TX);
- printf ("%s ", plcstation->hardware);
- printf ("%s ", plcstation->firmware);
- printf ("\n");
- plcstation++;
- }
- plcnetwork = (struct plcnetwork *)(plcstation);
- }
- return (0);
- }
- #endif
|