]>
The Tcpdump Group git mirrors - tcpdump/blob - print-forces.c
2 * Redistribution and use in source and binary forms, with or without
3 * modification, are permitted provided that: (1) source code
4 * distributions retain the above copyright notice and this paragraph
5 * in its entirety, and (2) distributions including binary code include
6 * the above copyright notice and this paragraph in its entirety in
7 * the documentation or other materials provided with the distribution.
8 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
9 * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
10 * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
11 * FOR A PARTICULAR PURPOSE.
13 * Copyright (c) 2009 Mojatatu Networks, Inc
21 #include <tcpdump-stdinc.h>
26 #include "interface.h"
34 prestlv_print(register const u_char
* pptr
, register u_int len
,
35 u_int16_t op_msk _U_
, int indent
)
37 const struct forces_tlv
*tlv
= (struct forces_tlv
*)pptr
;
38 register const u_char
*tdp
= (u_char
*) TLV_DATA(tlv
);
39 struct res_val
*r
= (struct res_val
*)tdp
;
43 * pdatacnt_print() has ensured that len (the TLV length)
46 dlen
= len
- TLV_HDRL
;
48 printf("illegal RESULT-TLV: %d bytes!\n", dlen
);
53 if (r
->result
>= 0x18 && r
->result
<= 0xFE) {
54 printf("illegal reserved result code: 0x%x!\n", r
->result
);
59 char *ib
= indent_pr(indent
, 0);
60 printf("%s Result: %s (code 0x%x)\n", ib
,
61 tok2str(ForCES_errs
, NULL
, r
->result
), r
->result
);
66 fputs("[|forces]", stdout
);
71 fdatatlv_print(register const u_char
* pptr
, register u_int len
,
72 u_int16_t op_msk _U_
, int indent
)
74 const struct forces_tlv
*tlv
= (struct forces_tlv
*)pptr
;
76 register const u_char
*tdp
= (u_char
*) TLV_DATA(tlv
);
80 * pdatacnt_print() or pkeyitlv_print() has ensured that len
81 * (the TLV length) >= TLV_HDRL.
83 rlen
= len
- TLV_HDRL
;
85 type
= EXTRACT_16BITS(&tlv
->type
);
86 if (type
!= F_TLV_FULD
) {
87 printf("Error: expecting FULLDATA!\n");
92 char *ib
= indent_pr(indent
+ 2, 1);
93 printf("%s[", &ib
[1]);
94 hex_print_with_offset(ib
, tdp
, rlen
, 0);
95 printf("\n%s]\n", &ib
[1]);
100 fputs("[|forces]", stdout
);
105 sdatailv_print(register const u_char
* pptr
, register u_int len
,
106 u_int16_t op_msk _U_
, int indent
)
109 const struct forces_ilv
*ilv
= (struct forces_ilv
*)pptr
;
112 if (len
< ILV_HDRL
) {
113 printf("Error: BAD SPARSEDATA-TLV!\n");
116 rlen
= len
- ILV_HDRL
;
120 invilv
= ilv_valid(ilv
, rlen
);
122 printf("Error: BAD ILV!\n");
126 register const u_char
*tdp
= (u_char
*) ILV_DATA(ilv
);
127 char *ib
= indent_pr(indent
, 1);
128 printf("\n%s SPARSEDATA: type %x length %d\n", &ib
[1],
129 EXTRACT_32BITS(&ilv
->type
),
130 EXTRACT_32BITS(&ilv
->length
));
131 printf("%s[", &ib
[1]);
132 hex_print_with_offset(ib
, tdp
, rlen
, 0);
133 printf("\n%s]\n", &ib
[1]);
136 ilv
= GO_NXT_ILV(ilv
, rlen
);
142 fputs("[|forces]", stdout
);
147 sdatatlv_print(register const u_char
* pptr
, register u_int len
,
148 u_int16_t op_msk
, int indent
)
150 const struct forces_tlv
*tlv
= (struct forces_tlv
*)pptr
;
152 register const u_char
*tdp
= (u_char
*) TLV_DATA(tlv
);
156 * pdatacnt_print() has ensured that len (the TLV length)
159 rlen
= len
- TLV_HDRL
;
161 type
= EXTRACT_16BITS(&tlv
->type
);
162 if (type
!= F_TLV_SPAD
) {
163 printf("Error: expecting SPARSEDATA!\n");
167 return sdatailv_print(tdp
, rlen
, op_msk
, indent
);
170 fputs("[|forces]", stdout
);
175 pkeyitlv_print(register const u_char
* pptr
, register u_int len
,
176 u_int16_t op_msk
, int indent
)
178 const struct forces_tlv
*tlv
= (struct forces_tlv
*)pptr
;
179 register const u_char
*tdp
= (u_char
*) TLV_DATA(tlv
);
180 register const u_char
*dp
= tdp
+ 4;
181 const struct forces_tlv
*kdtlv
= (struct forces_tlv
*)dp
;
183 char *ib
= indent_pr(indent
, 0);
188 id
= EXTRACT_32BITS(tdp
);
189 printf("%sKeyinfo: Key 0x%x\n", ib
, id
);
191 type
= EXTRACT_16BITS(&kdtlv
->type
);
192 invtlv
= tlv_valid(kdtlv
, len
);
195 printf("%s TLV type 0x%x len %d\n",
196 tok2str(ForCES_TLV_err
, NULL
, invtlv
), type
,
197 EXTRACT_16BITS(&kdtlv
->length
));
201 * At this point, tlv_valid() has ensured that the TLV
202 * length is large enough but not too large (it doesn't
203 * go past the end of the containing TLV).
205 tll
= EXTRACT_16BITS(&kdtlv
->length
);
206 dp
= (u_char
*) TLV_DATA(kdtlv
);
207 return fdatatlv_print(dp
, tll
, op_msk
, indent
);
210 fputs("[|forces]", stdout
);
215 pdatacnt_print(register const u_char
* pptr
, register u_int len
,
216 u_int32_t IDcnt
, u_int16_t op_msk
, int indent
)
221 char *ib
= indent_pr(indent
, 0);
223 for (i
= 0; i
< IDcnt
; i
++) {
227 id
= EXTRACT_32BITS(pptr
);
229 printf("%s ID#%02u: %d\n", ib
, i
+ 1, id
);
234 const struct forces_tlv
*pdtlv
= (struct forces_tlv
*)pptr
;
242 type
= EXTRACT_16BITS(&pdtlv
->type
);
243 invtlv
= tlv_valid(pdtlv
, len
);
246 ("%s Outstanding bytes %d for TLV type 0x%x TLV len %d\n",
247 tok2str(ForCES_TLV_err
, NULL
, invtlv
), len
, type
,
248 EXTRACT_16BITS(&pdtlv
->length
));
252 * At this point, tlv_valid() has ensured that the TLV
253 * length is large enough but not too large (it doesn't
254 * go past the end of the containing TLV).
256 tll
= EXTRACT_16BITS(&pdtlv
->length
) - TLV_HDRL
;
257 aln
= F_ALN_LEN(EXTRACT_16BITS(&pdtlv
->length
));
258 if (aln
> EXTRACT_16BITS(&pdtlv
->length
)) {
261 ("Invalid padded pathdata TLV type 0x%x len %d missing %d pad bytes\n",
262 type
, EXTRACT_16BITS(&pdtlv
->length
), aln
- len
);
264 pad
= aln
- EXTRACT_16BITS(&pdtlv
->length
);
267 if (pd_valid(type
)) {
268 const struct pdata_ops
*ops
= get_forces_pd(type
);
270 if (vflag
>= 3 && ops
->v
!= F_TLV_PDAT
) {
273 ("%s %s (Length %d DataLen %d pad %d Bytes)\n",
274 ib
, ops
->s
, EXTRACT_16BITS(&pdtlv
->length
),
278 ("%s %s (Length %d DataLen %d Bytes)\n",
279 ib
, ops
->s
, EXTRACT_16BITS(&pdtlv
->length
),
283 chk_op_type(type
, op_msk
, ops
->op_msk
);
285 rc
= ops
->print((const u_char
*)pdtlv
,
286 tll
+ pad
+ TLV_HDRL
, op_msk
,
289 printf("Invalid path data content type 0x%x len %d\n",
290 type
, EXTRACT_16BITS(&pdtlv
->length
));
292 if (EXTRACT_16BITS(&pdtlv
->length
)) {
293 hex_print_with_offset("Bad Data val\n\t [",
304 fputs("[|forces]", stdout
);
309 pdata_print(register const u_char
* pptr
, register u_int len
,
310 u_int16_t op_msk
, int indent
)
312 const struct pathdata_h
*pdh
= (struct pathdata_h
*)pptr
;
313 char *ib
= indent_pr(indent
, 0);
317 if (len
< sizeof(struct pathdata_h
))
320 printf("\n%sPathdata: Flags 0x%x ID count %d\n",
321 ib
, EXTRACT_16BITS(&pdh
->pflags
), EXTRACT_16BITS(&pdh
->pIDcnt
));
324 if (EXTRACT_16BITS(&pdh
->pflags
) & F_SELKEY
) {
327 pptr
+= sizeof(struct pathdata_h
);
328 len
-= sizeof(struct pathdata_h
);
329 minsize
= EXTRACT_16BITS(&pdh
->pIDcnt
) * 4;
331 printf("\t\t\ttruncated IDs expected %uB got %uB\n", minsize
,
333 hex_print_with_offset("\t\t\tID Data[", pptr
, len
, 0);
337 return pdatacnt_print(pptr
, len
, EXTRACT_16BITS(&pdh
->pIDcnt
), op_msk
, indent
);
340 fputs("[|forces]", stdout
);
345 genoptlv_print(register const u_char
* pptr
, register u_int len
,
346 u_int16_t op_msk
, int indent
)
348 const struct forces_tlv
*pdtlv
= (struct forces_tlv
*)pptr
;
352 char *ib
= indent_pr(indent
, 0);
355 type
= EXTRACT_16BITS(&pdtlv
->type
);
356 tll
= EXTRACT_16BITS(&pdtlv
->length
) - TLV_HDRL
;
357 invtlv
= tlv_valid(pdtlv
, len
);
358 printf("genoptlvprint - %s TLV type 0x%x len %d\n",
359 tok2str(ForCES_TLV
, NULL
, type
), type
, EXTRACT_16BITS(&pdtlv
->length
));
362 * At this point, tlv_valid() has ensured that the TLV
363 * length is large enough but not too large (it doesn't
364 * go past the end of the containing TLV).
366 register const u_char
*dp
= (u_char
*) TLV_DATA(pdtlv
);
367 if (!ttlv_valid(type
)) {
368 printf("%s TLV type 0x%x len %d\n",
369 tok2str(ForCES_TLV_err
, NULL
, invtlv
), type
,
370 EXTRACT_16BITS(&pdtlv
->length
));
374 printf("%s%s, length %d (data length %d Bytes)",
375 ib
, tok2str(ForCES_TLV
, NULL
, type
),
376 EXTRACT_16BITS(&pdtlv
->length
), tll
);
378 return pdata_print(dp
, tll
, op_msk
, indent
+ 1);
380 printf("\t\t\tInvalid ForCES TLV type=%x", type
);
385 fputs("[|forces]", stdout
);
390 recpdoptlv_print(register const u_char
* pptr
, register u_int len
,
391 u_int16_t op_msk
, int indent
)
393 const struct forces_tlv
*pdtlv
= (struct forces_tlv
*)pptr
;
398 register const u_char
*dp
;
403 invtlv
= tlv_valid(pdtlv
, len
);
409 * At this point, tlv_valid() has ensured that the TLV
410 * length is large enough but not too large (it doesn't
411 * go past the end of the containing TLV).
413 ib
= indent_pr(indent
, 0);
414 type
= EXTRACT_16BITS(&pdtlv
->type
);
415 dp
= (u_char
*) TLV_DATA(pdtlv
);
416 tll
= EXTRACT_16BITS(&pdtlv
->length
) - TLV_HDRL
;
420 ("%s%s, length %d (data encapsulated %d Bytes)",
421 ib
, tok2str(ForCES_TLV
, NULL
, type
),
422 EXTRACT_16BITS(&pdtlv
->length
),
423 EXTRACT_16BITS(&pdtlv
->length
) - TLV_HDRL
);
425 rc
= pdata_print(dp
, tll
, op_msk
, indent
+ 1);
426 pdtlv
= GO_NXT_TLV(pdtlv
, len
);
431 ("\n\t\tMessy PATHDATA TLV header, type (0x%x)\n\t\texcess of %d Bytes ",
432 EXTRACT_16BITS(&pdtlv
->type
), len
- EXTRACT_16BITS(&pdtlv
->length
));
439 fputs("[|forces]", stdout
);
444 invoptlv_print(register const u_char
* pptr
, register u_int len
,
445 u_int16_t op_msk _U_
, int indent
)
447 char *ib
= indent_pr(indent
, 1);
450 printf("%sData[", &ib
[1]);
451 hex_print_with_offset(ib
, pptr
, len
, 0);
457 int otlv_print(const struct forces_tlv
*otlv
, u_int16_t op_msk _U_
, int indent
)
460 register const u_char
*dp
= (u_char
*) TLV_DATA(otlv
);
463 char *ib
= indent_pr(indent
, 0);
464 const struct optlv_h
*ops
;
467 * lfbselect_print() has ensured that EXTRACT_16BITS(&otlv->length)
471 type
= EXTRACT_16BITS(&otlv
->type
);
472 tll
= EXTRACT_16BITS(&otlv
->length
) - TLV_HDRL
;
473 ops
= get_forces_optlv_h(type
);
475 printf("%sOper TLV %s(0x%x) length %d\n", ib
, ops
->s
, type
,
476 EXTRACT_16BITS(&otlv
->length
));
478 /* empty TLVs like COMMIT and TRCOMMIT are empty, we stop here .. */
479 if (!ops
->flags
& ZERO_TTLV
) {
480 if (tll
!= 0) /* instead of "if (tll)" - for readability .. */
481 printf("%s: Illegal - MUST be empty\n", ops
->s
);
484 /* rest of ops must at least have 12B {pathinfo} */
485 if (tll
< OP_MIN_SIZ
) {
486 printf("\t\tOper TLV %s(0x%x) length %d\n", ops
->s
, type
,
487 EXTRACT_16BITS(&otlv
->length
));
488 printf("\t\tTruncated data size %d minimum required %d\n", tll
,
490 return invoptlv_print(dp
, tll
, ops
->op_msk
, indent
);
494 rc
= ops
->print(dp
, tll
, ops
->op_msk
, indent
+ 1);
498 fputs("[|forces]", stdout
);
505 asttlv_print(register const u_char
* pptr
, register u_int len
,
506 u_int16_t op_msk _U_
, int indent
)
510 char *ib
= indent_pr(indent
, 0);
513 * forces_type_print() has ensured that len (the TLV length)
516 dlen
= len
- TLV_HDRL
;
517 if (dlen
!= ASTDLN
) {
518 printf("illegal ASTresult-TLV: %d bytes!\n", dlen
);
522 rescode
= EXTRACT_32BITS(pptr
);
523 if (rescode
> ASTMCD
) {
524 printf("illegal ASTresult result code: %d!\n", rescode
);
529 printf("Teardown reason:\n%s", ib
);
532 printf("Normal Teardown");
535 printf("Loss of Heartbeats");
538 printf("Out of bandwidth");
541 printf("Out of Memory");
544 printf("Application Crash");
547 printf("Unknown Teardown reason");
550 printf("(%x)\n%s", rescode
, ib
);
555 fputs("[|forces]", stdout
);
562 asrtlv_print(register const u_char
* pptr
, register u_int len
,
563 u_int16_t op_msk _U_
, int indent
)
567 char *ib
= indent_pr(indent
, 0);
570 * forces_type_print() has ensured that len (the TLV length)
573 dlen
= len
- TLV_HDRL
;
574 if (dlen
!= ASRDLN
) { /* id, instance, oper tlv */
575 printf("illegal ASRresult-TLV: %d bytes!\n", dlen
);
579 rescode
= EXTRACT_32BITS(pptr
);
581 if (rescode
> ASRMCD
) {
582 printf("illegal ASRresult result code: %d!\n", rescode
);
593 printf("FE ID invalid ");
596 printf("permission denied ");
602 printf("(%x)\n%s", rescode
, ib
);
607 fputs("[|forces]", stdout
);
615 gentltlv_print(register const u_char
* pptr _U_
, register u_int len
,
616 u_int16_t op_msk _U_
, int indent _U_
)
618 u_int dlen
= len
- TLV_HDRL
;
620 if (dlen
< 4) { /* at least 32 bits must exist */
621 printf("truncated TLV: %d bytes missing! ", 4 - dlen
);
629 print_metailv(register const u_char
* pptr
, register u_int len
,
630 u_int16_t op_msk _U_
, int indent
)
634 char *ib
= indent_pr(indent
, 0);
635 /* XXX: check header length */
636 const struct forces_ilv
*ilv
= (struct forces_ilv
*)pptr
;
639 * print_metatlv() has ensured that len (what remains in the
642 dlen
= len
- ILV_HDRL
;
645 printf("\n%sMetaID 0x%x length %d\n", ib
, EXTRACT_32BITS(&ilv
->type
),
646 EXTRACT_32BITS(&ilv
->length
));
647 hex_print_with_offset("\n\t\t\t\t[", ILV_DATA(ilv
), rlen
, 0);
651 fputs("[|forces]", stdout
);
656 print_metatlv(register const u_char
* pptr
, register u_int len
,
657 u_int16_t op_msk _U_
, int indent
)
660 char *ib
= indent_pr(indent
, 0);
662 const struct forces_ilv
*ilv
= (struct forces_ilv
*)pptr
;
666 * redirect_print() has ensured that len (what remains in the
669 dlen
= len
- TLV_HDRL
;
671 printf("\n%s METADATA\n", ib
);
674 invilv
= ilv_valid(ilv
, rlen
);
679 * At this point, ilv_valid() has ensured that the ILV
680 * length is large enough but not too large (it doesn't
681 * go past the end of the containing TLV).
683 print_metailv((u_char
*) ilv
, rlen
, 0, indent
+ 1);
685 ilv
= GO_NXT_ILV(ilv
, rlen
);
691 fputs("[|forces]", stdout
);
698 print_reddata(register const u_char
* pptr
, register u_int len
,
699 u_int16_t op_msk _U_
, int indent _U_
)
704 const struct forces_tlv
*tlv
= (struct forces_tlv
*)pptr
;
707 * redirect_print() has ensured that len (what remains in the
710 dlen
= len
- TLV_HDRL
;
711 printf("\n\t\t Redirect DATA\n");
712 if (dlen
<= RD_MIN
) {
713 printf("\n\t\ttruncated Redirect data: %d bytes missing! ",
720 invtlv
= tlv_valid(tlv
, rlen
);
723 printf("Redir data type 0x%x len %d\n", EXTRACT_16BITS(&tlv
->type
),
724 EXTRACT_16BITS(&tlv
->length
));
729 * At this point, tlv_valid() has ensured that the TLV
730 * length is large enough but not too large (it doesn't
731 * go past the end of the containing TLV).
734 hex_print_with_offset("\n\t\t\t[", TLV_DATA(tlv
), rlen
, 0);
738 fputs("[|forces]", stdout
);
743 redirect_print(register const u_char
* pptr
, register u_int len
,
744 u_int16_t op_msk _U_
, int indent
)
746 const struct forces_tlv
*tlv
= (struct forces_tlv
*)pptr
;
752 * forces_type_print() has ensured that len (the TLV length)
755 dlen
= len
- TLV_HDRL
;
756 if (dlen
<= RD_MIN
) {
757 printf("\n\t\ttruncated Redirect TLV: %d bytes missing! ",
766 invtlv
= tlv_valid(tlv
, rlen
);
771 * At this point, tlv_valid() has ensured that the TLV
772 * length is large enough but not too large (it doesn't
773 * go past the end of the containing TLV).
775 if (EXTRACT_16BITS(&tlv
->type
) == F_TLV_METD
) {
776 print_metatlv((u_char
*) TLV_DATA(tlv
), rlen
, 0, indent
);
777 } else if ((EXTRACT_16BITS(&tlv
->type
) == F_TLV_REDD
)) {
778 print_reddata((u_char
*) TLV_DATA(tlv
), rlen
, 0, indent
);
780 printf("Unknown REDIRECT TLV 0x%x len %d\n",
781 EXTRACT_16BITS(&tlv
->type
), EXTRACT_16BITS(&tlv
->length
));
784 tlv
= GO_NXT_TLV(tlv
, rlen
);
789 ("\n\t\tMessy Redirect TLV header, type (0x%x)\n\t\texcess of %d Bytes ",
790 EXTRACT_16BITS(&tlv
->type
), rlen
- EXTRACT_16BITS(&tlv
->length
));
797 fputs("[|forces]", stdout
);
805 lfbselect_print(register const u_char
* pptr
, register u_int len
,
806 u_int16_t op_msk
, int indent
)
808 const struct forces_lfbsh
*lfbs
;
809 const struct forces_tlv
*otlv
;
810 char *ib
= indent_pr(indent
, 0);
816 * forces_type_print() has ensured that len (the TLV length)
819 dlen
= len
- TLV_HDRL
;
820 if (dlen
<= OP_MIN
) { /* id, instance, oper tlv header .. */
821 printf("\n\t\ttruncated lfb selector: %d bytes missing! ",
827 * At this point, we know that dlen > OP_MIN; OP_OFF < OP_MIN, so
828 * we also know that it's > OP_OFF.
830 rlen
= dlen
- OP_OFF
;
832 lfbs
= (const struct forces_lfbsh
*)pptr
;
835 printf("\n%s%s(Classid %x) instance %x\n",
836 ib
, tok2str(ForCES_LFBs
, NULL
, EXTRACT_32BITS(&lfbs
->class)),
837 EXTRACT_32BITS(&lfbs
->class),
838 EXTRACT_32BITS(&lfbs
->instance
));
841 otlv
= (struct forces_tlv
*)(lfbs
+ 1);
846 invtlv
= tlv_valid(otlv
, rlen
);
851 * At this point, tlv_valid() has ensured that the TLV
852 * length is large enough but not too large (it doesn't
853 * go past the end of the containing TLV).
855 if (op_valid(EXTRACT_16BITS(&otlv
->type
), op_msk
)) {
856 otlv_print(otlv
, 0, indent
);
861 ("\t\tINValid oper-TLV type 0x%x length %d for this ForCES message\n",
862 EXTRACT_16BITS(&otlv
->type
), EXTRACT_16BITS(&otlv
->length
));
863 invoptlv_print((u_char
*)otlv
, rlen
, 0, indent
);
865 otlv
= GO_NXT_TLV(otlv
, rlen
);
870 ("\n\t\tMessy oper TLV header, type (0x%x)\n\t\texcess of %d Bytes ",
871 EXTRACT_16BITS(&otlv
->type
), rlen
- EXTRACT_16BITS(&otlv
->length
));
878 fputs("[|forces]", stdout
);
883 forces_type_print(register const u_char
* pptr
, const struct forcesh
*fhdr _U_
,
884 register u_int mlen
, const struct tom_h
*tops
)
886 const struct forces_tlv
*tltlv
;
893 * forces_print() has already checked that mlen >= ForCES_HDRL
894 * by calling ForCES_HLN_VALID().
896 rlen
= mlen
- ForCES_HDRL
;
898 if (rlen
> TLV_HLN
) {
899 if (tops
->flags
& ZERO_TTLV
) {
900 printf("<0x%x>Illegal Top level TLV!\n", tops
->flags
);
904 if (tops
->flags
& ZERO_MORE_TTLV
)
906 if (tops
->flags
& ONE_MORE_TTLV
) {
907 printf("\tTop level TLV Data missing!\n");
912 if (tops
->flags
& ZERO_TTLV
) {
916 ttlv
= tops
->flags
>> 4;
917 tltlv
= GET_TOP_TLV(pptr
);
919 /*XXX: 15 top level tlvs will probably be fine
920 You are nuts if you send more ;-> */
923 invtlv
= tlv_valid(tltlv
, rlen
);
928 * At this point, tlv_valid() has ensured that the TLV
929 * length is large enough but not too large (it doesn't
930 * go past the end of the packet).
932 if (!ttlv_valid(EXTRACT_16BITS(&tltlv
->type
))) {
933 printf("\n\tInvalid ForCES Top TLV type=0x%x",
934 EXTRACT_16BITS(&tltlv
->type
));
939 printf("\t%s, length %d (data length %d Bytes)",
940 tok2str(ForCES_TLV
, NULL
, EXTRACT_16BITS(&tltlv
->type
)),
941 EXTRACT_16BITS(&tltlv
->length
),
942 EXTRACT_16BITS(&tltlv
->length
) - TLV_HDRL
);
944 rc
= tops
->print((u_char
*) TLV_DATA(tltlv
),
945 EXTRACT_16BITS(&tltlv
->length
), tops
->op_msk
, 9);
949 tltlv
= GO_NXT_TLV(tltlv
, rlen
);
955 * XXX - if ttlv != 0, does that mean that the packet was too
956 * short, and didn't have *enough* TLVs in it?
959 printf("\tMess TopTLV header: min %u, total %d advertised %d ",
960 TLV_HDRL
, rlen
, EXTRACT_16BITS(&tltlv
->length
));
967 fputs("[|forces]", stdout
);
971 void forces_print(register const u_char
* pptr
, register u_int len
)
973 const struct forcesh
*fhdr
;
976 const struct tom_h
*tops
;
979 fhdr
= (const struct forcesh
*)pptr
;
981 if (!tom_valid(fhdr
->fm_tom
)) {
982 printf("Invalid ForCES message type %d\n", fhdr
->fm_tom
);
986 mlen
= ForCES_BLN(fhdr
);
988 tops
= get_forces_tom(fhdr
->fm_tom
);
989 if (tops
->v
== TOM_RSVD
) {
990 printf("\n\tUnknown ForCES message type=0x%x", fhdr
->fm_tom
);
994 printf("\n\tForCES %s ", tops
->s
);
995 if (!ForCES_HLN_VALID(mlen
, len
)) {
997 ("Illegal ForCES pkt len - min %u, total recvd %d, advertised %d ",
998 ForCES_HDRL
, len
, ForCES_BLN(fhdr
));
1002 TCHECK2(*(pptr
+ 20), 4);
1003 flg_raw
= EXTRACT_32BITS(pptr
+ 20);
1005 printf("\n\tForCES Version %d len %uB flags 0x%08x ",
1006 ForCES_V(fhdr
), mlen
, flg_raw
);
1007 printf("\n\tSrcID 0x%x(%s) DstID 0x%x(%s) Correlator 0x%" PRIu64
,
1008 ForCES_SID(fhdr
), ForCES_node(ForCES_SID(fhdr
)),
1009 ForCES_DID(fhdr
), ForCES_node(ForCES_DID(fhdr
)),
1010 EXTRACT_64BITS(fhdr
->fm_cor
));
1015 ("\n\tForCES flags:\n\t %s(0x%x), prio=%d, %s(0x%x),\n\t %s(0x%x), %s(0x%x)\n",
1016 ForCES_ACKp(ForCES_ACK(fhdr
)), ForCES_ACK(fhdr
),
1018 ForCES_EMp(ForCES_EM(fhdr
)), ForCES_EM(fhdr
),
1019 ForCES_ATp(ForCES_AT(fhdr
)), ForCES_AT(fhdr
),
1020 ForCES_TPp(ForCES_TP(fhdr
)), ForCES_TP(fhdr
));
1022 ("\t Extra flags: rsv(b5-7) 0x%x rsv(b13-31) 0x%x\n",
1023 ForCES_RS1(fhdr
), ForCES_RS2(fhdr
));
1025 rc
= forces_type_print(pptr
, fhdr
, mlen
, tops
);
1028 hex_print_with_offset("\n\t[", pptr
, len
, 0);
1034 printf("\n\t Raw ForCES message\n\t [");
1035 hex_print_with_offset("\n\t ", pptr
, len
, 0);
1042 fputs("[|forces]", stdout
);