]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-rx.c
OpenFlow: Have a function for each message type.
[tcpdump] / print-rx.c
index 6c4ce85879919fe11fa020b37385a645bb95ce69..4f0195282ff6340db97a2f2bd23ef74225e02d28 100644 (file)
@@ -766,7 +766,6 @@ rx_cache_find(netdissect_options *ndo, const struct rx_header *rxh,
                }
 
 #define STROUT(MAX) { uint32_t _i; \
-                       ND_TCHECK_LEN(bp, sizeof(uint32_t)); \
                        _i = GET_BE_U_4(bp); \
                        if (_i > (MAX)) \
                                goto trunc; \
@@ -779,28 +778,24 @@ rx_cache_find(netdissect_options *ndo, const struct rx_header *rxh,
                }
 
 #define INTOUT() { int32_t _i; \
-                       ND_TCHECK_4(bp); \
                        _i = GET_BE_S_4(bp); \
                        bp += sizeof(int32_t); \
                        ND_PRINT(" %d", _i); \
                }
 
 #define UINTOUT() { uint32_t _i; \
-                       ND_TCHECK_4(bp); \
                        _i = GET_BE_U_4(bp); \
                        bp += sizeof(uint32_t); \
                        ND_PRINT(" %u", _i); \
                }
 
 #define UINT64OUT() { uint64_t _i; \
-                       ND_TCHECK_LEN(bp, sizeof(uint64_t)); \
                        _i = GET_BE_U_8(bp); \
                        bp += sizeof(uint64_t); \
                        ND_PRINT(" %" PRIu64, _i); \
                }
 
 #define DATEOUT() { time_t _t; struct tm *tm; char str[256]; \
-                       ND_TCHECK_4(bp); \
                        _t = (time_t) GET_BE_S_4(bp); \
                        bp += sizeof(int32_t); \
                        tm = localtime(&_t); \
@@ -903,7 +898,6 @@ fs_print(netdissect_options *ndo,
         * gleaned from fsint/afsint.xg
         */
 
-       ND_TCHECK_4(bp + sizeof(struct rx_header));
        fs_op = GET_BE_U_4(bp + sizeof(struct rx_header));
 
        ND_PRINT(" fs call %s", tok2str(fs_req, "op#%u", fs_op));
@@ -955,11 +949,10 @@ fs_print(netdissect_options *ndo,
                {
                        char a[AFSOPAQUEMAX+1];
                        FIDOUT();
-                       ND_TCHECK_4(bp);
                        i = GET_BE_U_4(bp);
                        bp += sizeof(uint32_t);
                        ND_TCHECK_LEN(bp, i);
-                       i = min(AFSOPAQUEMAX, i);
+                       i = ND_MIN(AFSOPAQUEMAX, i);
                        strncpy(a, (const char *) bp, i);
                        a[i] = '\0';
                        acl_print(ndo, (u_char *) a, (u_char *) a + i);
@@ -1012,7 +1005,6 @@ fs_print(netdissect_options *ndo,
                case 65536:     /* Inline bulk stat */
                {
                        uint32_t j;
-                       ND_TCHECK_4(bp);
                        j = GET_BE_U_4(bp);
                        bp += sizeof(uint32_t);
 
@@ -1091,11 +1083,10 @@ fs_reply_print(netdissect_options *ndo,
                case 131:       /* Fetch ACL */
                {
                        char a[AFSOPAQUEMAX+1];
-                       ND_TCHECK_4(bp);
                        i = GET_BE_U_4(bp);
                        bp += sizeof(uint32_t);
                        ND_TCHECK_LEN(bp, i);
-                       i = min(AFSOPAQUEMAX, i);
+                       i = ND_MIN(AFSOPAQUEMAX, i);
                        strncpy(a, (const char *) bp, i);
                        a[i] = '\0';
                        acl_print(ndo, (u_char *) a, (u_char *) a + i);
@@ -1122,7 +1113,6 @@ fs_reply_print(netdissect_options *ndo,
                 */
                int32_t errcode;
 
-               ND_TCHECK_4(bp);
                errcode = GET_BE_S_4(bp);
                bp += sizeof(int32_t);
 
@@ -1231,7 +1221,6 @@ cb_print(netdissect_options *ndo,
         * gleaned from fsint/afscbint.xg
         */
 
-       ND_TCHECK_4(bp + sizeof(struct rx_header));
        cb_op = GET_BE_U_4(bp + sizeof(struct rx_header));
 
        ND_PRINT(" cb call %s", tok2str(cb_req, "op#%u", cb_op));
@@ -1247,7 +1236,6 @@ cb_print(netdissect_options *ndo,
                case 204:               /* Callback */
                {
                        uint32_t j, t;
-                       ND_TCHECK_4(bp);
                        j = GET_BE_U_4(bp);
                        bp += sizeof(uint32_t);
 
@@ -1260,7 +1248,6 @@ cb_print(netdissect_options *ndo,
                        if (j == 0)
                                ND_PRINT(" <none!>");
 
-                       ND_TCHECK_4(bp);
                        j = GET_BE_U_4(bp);
                        bp += sizeof(uint32_t);
 
@@ -1272,7 +1259,6 @@ cb_print(netdissect_options *ndo,
                                INTOUT();
                                ND_PRINT(" expires");
                                DATEOUT();
-                               ND_TCHECK_4(bp);
                                t = GET_BE_U_4(bp);
                                bp += sizeof(uint32_t);
                                tok2str(cb_types, "type %u", t);
@@ -1365,7 +1351,6 @@ prot_print(netdissect_options *ndo,
         * gleaned from ptserver/ptint.xg
         */
 
-       ND_TCHECK_4(bp + sizeof(struct rx_header));
        pt_op = GET_BE_U_4(bp + sizeof(struct rx_header));
 
        ND_PRINT(" pt");
@@ -1418,7 +1403,6 @@ prot_print(netdissect_options *ndo,
                case 504:       /* Name to ID */
                {
                        uint32_t j;
-                       ND_TCHECK_4(bp);
                        j = GET_BE_U_4(bp);
                        bp += sizeof(uint32_t);
 
@@ -1440,7 +1424,6 @@ prot_print(netdissect_options *ndo,
                {
                        uint32_t j;
                        ND_PRINT(" ids:");
-                       ND_TCHECK_4(bp);
                        i = GET_BE_U_4(bp);
                        bp += sizeof(uint32_t);
                        for (j = 0; j < i; j++)
@@ -1532,7 +1515,6 @@ prot_reply_print(netdissect_options *ndo,
                {
                        uint32_t j;
                        ND_PRINT(" ids:");
-                       ND_TCHECK_4(bp);
                        i = GET_BE_U_4(bp);
                        bp += sizeof(uint32_t);
                        for (j = 0; j < i; j++)
@@ -1544,7 +1526,6 @@ prot_reply_print(netdissect_options *ndo,
                case 505:               /* ID to name */
                {
                        uint32_t j;
-                       ND_TCHECK_4(bp);
                        j = GET_BE_U_4(bp);
                        bp += sizeof(uint32_t);
 
@@ -1569,7 +1550,6 @@ prot_reply_print(netdissect_options *ndo,
                case 519:               /* Get host CPS */
                {
                        uint32_t j;
-                       ND_TCHECK_4(bp);
                        j = GET_BE_U_4(bp);
                        bp += sizeof(uint32_t);
                        for (i = 0; i < j; i++) {
@@ -1621,7 +1601,6 @@ vldb_print(netdissect_options *ndo,
         * gleaned from vlserver/vldbint.xg
         */
 
-       ND_TCHECK_4(bp + sizeof(struct rx_header));
        vldb_op = GET_BE_U_4(bp + sizeof(struct rx_header));
 
        ND_PRINT(" vldb");
@@ -1651,7 +1630,6 @@ vldb_print(netdissect_options *ndo,
                case 518:       /* Get entry by ID N */
                        ND_PRINT(" volid");
                        INTOUT();
-                       ND_TCHECK_4(bp);
                        i = GET_BE_U_4(bp);
                        bp += sizeof(uint32_t);
                        if (i <= 2)
@@ -1671,7 +1649,6 @@ vldb_print(netdissect_options *ndo,
                case 520:       /* Replace entry N */
                        ND_PRINT(" volid");
                        INTOUT();
-                       ND_TCHECK_4(bp);
                        i = GET_BE_U_4(bp);
                        bp += sizeof(uint32_t);
                        if (i <= 2)
@@ -1747,7 +1724,6 @@ vldb_reply_print(netdissect_options *ndo,
                        ND_TCHECK_4(bp);
                        bp += sizeof(uint32_t);
                        ND_PRINT(" numservers");
-                       ND_TCHECK_4(bp);
                        nservers = GET_BE_U_4(bp);
                        bp += sizeof(uint32_t);
                        ND_PRINT(" %u", nservers);
@@ -1761,7 +1737,6 @@ vldb_reply_print(netdissect_options *ndo,
                        }
                        ND_PRINT(" partitions");
                        for (i = 0; i < 8; i++) {
-                               ND_TCHECK_4(bp);
                                j = GET_BE_U_4(bp);
                                if (i < nservers && j <= 26)
                                        ND_PRINT(" %c", 'a' + j);
@@ -1795,7 +1770,6 @@ vldb_reply_print(netdissect_options *ndo,
                {       uint32_t nservers, j;
                        VECOUT(VLNAMEMAX);
                        ND_PRINT(" numservers");
-                       ND_TCHECK_4(bp);
                        nservers = GET_BE_U_4(bp);
                        bp += sizeof(uint32_t);
                        ND_PRINT(" %u", nservers);
@@ -1809,7 +1783,6 @@ vldb_reply_print(netdissect_options *ndo,
                        }
                        ND_PRINT(" partitions");
                        for (i = 0; i < 13; i++) {
-                               ND_TCHECK_4(bp);
                                j = GET_BE_U_4(bp);
                                if (i < nservers && j <= 26)
                                        ND_PRINT(" %c", 'a' + j);
@@ -1832,7 +1805,6 @@ vldb_reply_print(netdissect_options *ndo,
                {       uint32_t nservers, j;
                        VECOUT(VLNAMEMAX);
                        ND_PRINT(" numservers");
-                       ND_TCHECK_4(bp);
                        nservers = GET_BE_U_4(bp);
                        bp += sizeof(uint32_t);
                        ND_PRINT(" %u", nservers);
@@ -1850,7 +1822,6 @@ vldb_reply_print(netdissect_options *ndo,
                        bp += 4 * 13;
                        ND_PRINT(" partitions");
                        for (i = 0; i < 13; i++) {
-                               ND_TCHECK_4(bp);
                                j = GET_BE_U_4(bp);
                                if (i < nservers && j <= 26)
                                        ND_PRINT(" %c", 'a' + j);
@@ -1903,7 +1874,6 @@ kauth_print(netdissect_options *ndo,
         * gleaned from kauth/kauth.rg
         */
 
-       ND_TCHECK_4(bp + sizeof(struct rx_header));
        kauth_op = GET_BE_U_4(bp + sizeof(struct rx_header));
 
        ND_PRINT(" kauth");
@@ -1945,7 +1915,6 @@ kauth_print(netdissect_options *ndo,
                        INTOUT();
                        ND_PRINT(" domain");
                        STROUT(KANAMEMAX);
-                       ND_TCHECK_4(bp);
                        i = GET_BE_U_4(bp);
                        bp += sizeof(uint32_t);
                        ND_TCHECK_LEN(bp, i);
@@ -2023,11 +1992,6 @@ kauth_reply_print(netdissect_options *ndo,
                ND_PRINT(" errcode");
                INTOUT();
        }
-
-       return;
-
-trunc:
-       ND_PRINT(" [|kauth]");
 }
 
 /*
@@ -2048,7 +2012,6 @@ vol_print(netdissect_options *ndo,
         * gleaned from volser/volint.xg
         */
 
-       ND_TCHECK_4(bp + sizeof(struct rx_header));
        vol_op = GET_BE_U_4(bp + sizeof(struct rx_header));
 
        ND_PRINT(" vol call %s", tok2str(vol_req, "op#%u", vol_op));
@@ -2200,7 +2163,6 @@ vol_print(netdissect_options *ndo,
                        DATEOUT();
                        {
                                uint32_t i, j;
-                               ND_TCHECK_4(bp);
                                j = GET_BE_U_4(bp);
                                bp += sizeof(uint32_t);
                                for (i = 0; i < j; i++) {
@@ -2330,7 +2292,6 @@ vol_reply_print(netdissect_options *ndo,
                        case 121:       /* List one volume */
                                {
                                        uint32_t i, j;
-                                       ND_TCHECK_4(bp);
                                        j = GET_BE_U_4(bp);
                                        bp += sizeof(uint32_t);
                                        for (i = 0; i < j; i++) {
@@ -2384,7 +2345,6 @@ bos_print(netdissect_options *ndo,
         * gleaned from bozo/bosint.xg
         */
 
-       ND_TCHECK_4(bp + sizeof(struct rx_header));
        bos_op = GET_BE_U_4(bp + sizeof(struct rx_header));
 
        ND_PRINT(" bos call %s", tok2str(bos_req, "op#%u", bos_op));
@@ -2495,11 +2455,6 @@ bos_reply_print(netdissect_options *ndo,
                ND_PRINT(" errcode");
                INTOUT();
        }
-
-       return;
-
-trunc:
-       ND_PRINT(" [|bos]");
 }
 
 /*
@@ -2548,7 +2503,6 @@ ubik_print(netdissect_options *ndo,
 
        switch (ubik_op) {
                case 10000:             /* Beacon */
-                       ND_TCHECK_4(bp);
                        temp = GET_BE_U_4(bp);
                        bp += sizeof(uint32_t);
                        ND_PRINT(" syncsite %s", temp ? "yes" : "no");
@@ -2580,7 +2534,6 @@ ubik_print(netdissect_options *ndo,
                        INTOUT();
                        ND_PRINT(" length");
                        INTOUT();
-                       ND_TCHECK_4(bp);
                        temp = GET_BE_U_4(bp);
                        bp += sizeof(uint32_t);
                        tok2str(ubik_lock_types, "type %u", temp);