clean debug messages and add black adn red sides
authorMazet Laurent <laurent.mazet@thalesgroup.com>
Thu, 24 Apr 2025 13:43:46 +0000 (15:43 +0200)
committerMazet Laurent <laurent.mazet@thalesgroup.com>
Thu, 24 Apr 2025 13:43:46 +0000 (15:43 +0200)
morep.c
morep_simulator.c

diff --git a/morep.c b/morep.c
index 129e33947b872d2b769f99c811365a142ad8ac6a..3c8733422903934860b3ce585f9f9ce9addaeb6b 100644 (file)
--- a/morep.c
+++ b/morep.c
@@ -322,7 +322,7 @@ int MOREP_Connect (char *url)
     /* info message */
     char lmac[MAC_ADDR_STRING] = {0};
     mactoa (lmac, sock_addr.sll_addr);
-    VERBOSE (morep, INFO, PRINTF ("I/O on %s local=[%s]\n", addr.ifname, lmac));
+    VERBOSE (morep, INFO, PRINTF ("I/O on %s local=[%s] etype=[%04x]\n", addr.ifname, lmac, addr.ether_type));
 
     /* store connection */
     int index = find_unused_morep ();
index b54bd90528b7fd8f392b9018454b06ae5e615f99..c398ce9429f80b1523d09be86165e04b83651514 100644 (file)
@@ -105,11 +105,21 @@ comm_t comm_list[MAXCOMMS] = {0};
 
 /* definition of all services */
 service_t service_list[] = {
+    {"CROSS_CRYPTO_BLACK", cross_crypto_e, {-1, 0, "0809"}, {-1, 1, "0809"}},
+    {"CROSS_CRYPTO_RED", cross_crypto_e, {-1, 0, "0809"}, {-1, 1, "0809"}},
     {"CROSS_CRYPTO", cross_crypto_e, {-1, 0, "0809"}, {-1, 1, "0809"}},
+    {"LOCAL_CRYPTO_BLACK", local_crypto_e, {-1, 0, "080a"}, {-1, 1, "080a"}},
+    {"LOCAL_CRYPTO_RED", local_crypto_e, {-1, 0, "080a"}, {-1, 1, "080a"}},
     {"LOCAL_CRYPTO", local_crypto_e, {-1, 0, "080a"}, {-1, 1, "080a"}},
+    {"PROVISIONING_RED", provisioning_e, {-1, 0, "080b"}, {-1, 1, "080b"}},
     {"PROVISIONING", provisioning_e, {-1, 0, "080b"}, {-1, 1, "080b"}},
+    {"PRNG_BLACK", prng_e, {-1, 0, "080c"}, {-1, 1, "080c"}},
+    {"PRNG_RED", prng_e, {-1, 0, "080c"}, {-1, 1, "080c"}},
     {"PRNG", prng_e, {-1, 0, "080c"}, {-1, 1, "080c"}},
+    {"BYPASS_BLACK", bypass_e, {-1, 0, "080d"}, {-1, 1, "080d"}},
+    {"BYPASS_RED", bypass_e, {-1, 0, "080d"}, {-1, 1, "080d"}},
     {"BYPASS", bypass_e, {-1, 0, "080d"}, {-1, 1, "080d"}},
+    {"CONTROL_RED", control_e, {-1, 0, "080e"}, {-1, 1, "080e"}},
     {"CONTROL", control_e, {-1, 0, "080e"}, {-1, 1, "080e"}},
     {"", noserv_e, {-1, 0, "0000"}, {-1, 1, "0000"}}
 };
@@ -385,7 +395,7 @@ int main (int argc, char **argv)
             VERBOSE (simul, TRACE, PRINTF ("no morep found '%s'\n", line));
             continue;
         }
-        VERBOSE (simul, DEBUG, PRINTF ("work with %c[%s]\n", comm->mode ? 'T' : 'R', serv->name));
+        VERBOSE (simul, DEBUG, PRINTF ("select %c[%s]\n", comm->mode ? 'T' : 'R', serv->name));
 
         /* skip space */
         tmp = line + offset;
@@ -430,7 +440,7 @@ int main (int argc, char **argv)
             VERBOSE (simul, WARNING, PRINTF ("message %s is not allowed for service %s (line '%s')\n", msg->name, serv->name, line));
             continue;
         }
-        VERBOSE (simul, DEBUG, PRINTF ("work with message %s\n", msg->name));
+        VERBOSE (simul, DEBUG, PRINTF ("%s message %s\n", comm->mode ? "sending" : "waiting", msg->name));
 
         CHANNEL_t pdu_channel = {0};
         CLEAR_DATA_t pdu_clear_data = {0};
@@ -512,7 +522,6 @@ int main (int argc, char **argv)
             uint8_t msgtype = 0;
             uint8_t payload[MOREP_PAYLOAD] = {0};
             seqnum = MOREP_Receive (comm->morep, &msgtype, payload, &len);
-printf("msgtype: %d\n", msgtype);
 
             /* check msg/pdu type */
             pdu = undef_pdu_e;
@@ -522,7 +531,6 @@ printf("msgtype: %d\n", msgtype);
                 if ((m->service_id == serv->service_id) && (m->msgtype == msgtype)) {
                     pdu = m->pdu;
                     msg = m;
-printf("msgtype: %d %d\n", msgtype, msg->msgtype);
                 }
             }
             /* check msg type */
@@ -530,7 +538,6 @@ printf("msgtype: %d %d\n", msgtype, msg->msgtype);
                 VERBOSE (simul, WARNING, PRINTF ("R:%s[%s] [SEQ=%d MSG=%d LEN=%d PDU=%d] message type is not allowed for this service\n", serv->name, comm->etype, seqnum, msg->msgtype, len, pdu));
                 continue;
             }
-printf("msgtype: %d %d %d\n", msgtype, msg->msgtype, exp_msg->msgtype);
             if (exp_msg->msgtype != msg->msgtype) {
                 VERBOSE (simul, WARNING, PRINTF ("R:%s[%s] [SEQ=%d MSG=%d LEN=%d PDU=%d] expected message type %s\n", serv->name, comm->etype, seqnum, msg->msgtype, len, pdu, exp_msg->name));
                 continue;