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"
31 * Per draft-ietf-forces-protocol-22
34 #define ForCES_HDRL 24
35 #define ForCES_ALNL 4U
40 #define TOM_ASSNSETUP 0x1
41 #define TOM_ASSNTEARD 0x2
42 #define TOM_CONFIG 0x3
44 #define TOM_EVENTNOT 0x5
45 #define TOM_PKTREDIR 0x6
46 #define TOM_HEARTBT 0x0F
47 #define TOM_ASSNSETREP 0x11
48 #define TOM_CONFIGREP 0x13
49 #define TOM_QUERYREP 0x14
52 * tom_h Flags: resv1(8b):maxtlvs(4b):resv2(2b):mintlv(2b)
54 #define ZERO_TTLV 0x01
55 #define ZERO_MORE_TTLV 0x02
56 #define ONE_MORE_TTLV 0x04
62 #define TTLV_T1 (ONE_MORE_TTLV|ONE_TLV)
63 #define TTLV_T2 (ONE_MORE_TTLV|MAX_TLV)
70 int (*print
) (register const u_char
* pptr
, register u_int len
,
71 u_int16_t op_msk
, int indent
);
88 #define TOM_MAX_IND (_TOM_RSV_MAX - 1)
90 static inline int tom_valid(u_int8_t tom
)
93 if (tom
>= 0x7 && tom
<= 0xe)
104 static inline const char *ForCES_node(u_int32_t node
)
106 if (node
<= 0x3FFFFFFF)
108 if (node
>= 0x40000000 && node
<= 0x7FFFFFFF)
110 if (node
>= 0xC0000000 && node
<= 0xFFFFFFEF)
111 return "AllMulticast";
112 if (node
== 0xFFFFFFFD)
113 return "AllCEsBroadcast";
114 if (node
== 0xFFFFFFFE)
115 return "AllFEsBroadcast";
116 if (node
== 0xFFFFFFFF)
117 return "AllBroadcast";
119 return "ForCESreserved";
123 static inline const char *ForCES_ACKp(u_int32_t flg
)
136 static inline const char *ForCES_EMp(u_int32_t flg
)
141 return "execute-all-or-none";
143 return "execute-until-failure";
145 return "continue-execute-on-failure";
149 static inline const char *ForCES_ATp(u_int32_t flg
)
154 return "2PCtransaction";
158 static inline const char *ForCES_TPp(u_int32_t flg
)
161 return "StartofTransaction";
163 return "MiddleofTransaction";
165 return "EndofTransaction";
172 * Structure of forces header, naked of TLVs.
175 u_int8_t fm_vrsvd
; /* version and reserved */
176 #define ForCES_V(forcesh) ((forcesh)->fm_vrsvd >> 4)
177 u_int8_t fm_tom
; /* type of message */
178 u_int16_t fm_len
; /* total length * 4 bytes */
179 #define ForCES_BLN(forcesh) ((u_int32_t)(EXTRACT_16BITS(&(forcesh)->fm_len) << 2))
180 u_int32_t fm_sid
; /* Source ID */
181 #define ForCES_SID(forcesh) EXTRACT_32BITS(&(forcesh)->fm_sid)
182 u_int32_t fm_did
; /* Destination ID */
183 #define ForCES_DID(forcesh) EXTRACT_32BITS(&(forcesh)->fm_did)
184 u_int8_t fm_cor
[8]; /* correlator */
185 u_int32_t fm_flags
; /* flags */
186 #define ForCES_ACK(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0xC0000000) >> 30)
187 #define ForCES_PRI(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x38000000) >> 27)
188 #define ForCES_RS1(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x07000000) >> 24)
189 #define ForCES_EM(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x00C00000) >> 22)
190 #define ForCES_AT(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x00200000) >> 21)
191 #define ForCES_TP(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x00180000) >> 19)
192 #define ForCES_RS2(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x0007FFFF) >> 0)
195 #define ForCES_HLN_VALID(fhl,tlen) ((tlen) >= ForCES_HDRL && \
196 (fhl) >= ForCES_HDRL && \
199 #define F_LFB_RSVD 0x0
200 #define F_LFB_FEO 0x1
201 #define F_LFB_FEPO 0x2
202 static const struct tok ForCES_LFBs
[] = {
203 {F_LFB_RSVD
, "Invalid TLV"},
204 {F_LFB_FEO
, "FEObj LFB"},
205 {F_LFB_FEPO
, "FEProtoObj LFB"},
228 #define F_OP_MAX (_F_OP_MAX - 1)
230 B_OP_SET
= 1 << (F_OP_SET
- 1),
231 B_OP_SETPROP
= 1 << (F_OP_SETPROP
- 1),
232 B_OP_SETRESP
= 1 << (F_OP_SETRESP
- 1),
233 B_OP_SETPRESP
= 1 << (F_OP_SETPRESP
- 1),
234 B_OP_DEL
= 1 << (F_OP_DEL
- 1),
235 B_OP_DELRESP
= 1 << (F_OP_DELRESP
- 1),
236 B_OP_GET
= 1 << (F_OP_GET
- 1),
237 B_OP_GETPROP
= 1 << (F_OP_GETPROP
- 1),
238 B_OP_GETRESP
= 1 << (F_OP_GETRESP
- 1),
239 B_OP_GETPRESP
= 1 << (F_OP_GETPRESP
- 1),
240 B_OP_REPORT
= 1 << (F_OP_REPORT
- 1),
241 B_OP_COMMIT
= 1 << (F_OP_COMMIT
- 1),
242 B_OP_RCOMMIT
= 1 << (F_OP_RCOMMIT
- 1),
243 B_OP_RTRCOMP
= 1 << (F_OP_RTRCOMP
- 1),
250 int (*print
) (register const u_char
* pptr
, register u_int len
,
251 u_int16_t op_msk
, int indent
);
254 static int genoptlv_print(register const u_char
* pptr
, register u_int len
,
255 u_int16_t op_msk
, int indent
);
256 static int recpdoptlv_print(register const u_char
* pptr
, register u_int len
,
257 u_int16_t op_msk
, int indent
);
258 static int invoptlv_print(register const u_char
* pptr
, register u_int len
,
259 u_int16_t op_msk
, int indent
);
274 static const struct optlv_h OPTLV_msg
[F_OP_MAX
+ 1] = {
275 /* F_OP_RSV */ {ZERO_TTLV
, 0, "Invalid OPTLV", invoptlv_print
},
276 /* F_OP_SET */ {TTLV_T2
, B_FULLD
| B_SPARD
, " Set", recpdoptlv_print
},
278 {TTLV_T2
, B_FULLD
| B_SPARD
, " SetProp", recpdoptlv_print
},
279 /* F_OP_SETRESP */ {TTLV_T2
, B_RESTV
, " SetResp", recpdoptlv_print
},
280 /* F_OP_SETPRESP */ {TTLV_T2
, B_RESTV
, " SetPropResp", recpdoptlv_print
},
281 /* F_OP_DEL */ {ZERO_TTLV
, 0, " Del", recpdoptlv_print
},
282 /* F_OP_DELRESP */ {TTLV_T2
, B_RESTV
, " DelResp", recpdoptlv_print
},
283 /* F_OP_GET */ {ZERO_TTLV
, 0, " Get", recpdoptlv_print
},
284 /* F_OP_GETPROP */ {ZERO_TTLV
, 0, " GetProp", recpdoptlv_print
},
286 {TTLV_T2
, B_FULLD
| B_SPARD
| B_RESTV
, " GetResp", recpdoptlv_print
},
288 {TTLV_T2
, B_FULLD
| B_RESTV
, " GetPropResp", recpdoptlv_print
},
290 {TTLV_T2
, B_FULLD
| B_SPARD
, " Report", recpdoptlv_print
},
291 /* F_OP_COMMIT */ {ZERO_TTLV
, 0, " Commit", NULL
},
292 /* F_OP_RCOMMIT */ {TTLV_T1
, B_RESTV
, " RCommit", genoptlv_print
},
293 /* F_OP_RTRCOMP */ {ZERO_TTLV
, 0, " RTRCOMP", NULL
},
296 static inline const struct optlv_h
*get_forces_optlv_h(u_int16_t opt
)
298 if (opt
> F_OP_MAX
|| opt
<= F_OP_RSV
)
299 return &OPTLV_msg
[F_OP_RSV
];
301 return &OPTLV_msg
[opt
];
306 #define IND_PREF '\n'
308 char ind_buf
[IND_SIZE
];
310 static inline char *indent_pr(int indent
, int nlpref
)
315 if (indent
> (IND_SIZE
- 1))
316 indent
= IND_SIZE
- 1;
324 while (--indent
>= 0)
331 static inline int op_valid(u_int16_t op
, u_int16_t mask
)
333 int opb
= 1 << (op
- 1);
339 /* I guess we should allow vendor operations? */
345 #define F_TLV_RSVD 0x0000
346 #define F_TLV_REDR 0x0001
347 #define F_TLV_ASRS 0x0010
348 #define F_TLV_ASRT 0x0011
349 #define F_TLV_LFBS 0x1000
350 #define F_TLV_PDAT 0x0110
351 #define F_TLV_KEYI 0x0111
352 #define F_TLV_FULD 0x0112
353 #define F_TLV_SPAD 0x0113
354 #define F_TLV_REST 0x0114
355 #define F_TLV_METD 0x0115
356 #define F_TLV_REDD 0x0116
357 #define F_TLV_TRNG 0x0117
360 #define F_TLV_VNST 0x8000
362 static const struct tok ForCES_TLV
[] = {
363 {F_TLV_RSVD
, "Invalid TLV"},
364 {F_TLV_REDR
, "REDIRECT TLV"},
365 {F_TLV_ASRS
, "ASResult TLV"},
366 {F_TLV_ASRT
, "ASTreason TLV"},
367 {F_TLV_LFBS
, "LFBselect TLV"},
368 {F_TLV_PDAT
, "PATH-DATA TLV"},
369 {F_TLV_KEYI
, "KEYINFO TLV"},
370 {F_TLV_FULD
, "FULLDATA TLV"},
371 {F_TLV_SPAD
, "SPARSEDATA TLV"},
372 {F_TLV_REST
, "RESULT TLV"},
373 {F_TLV_METD
, "METADATA TLV"},
374 {F_TLV_REDD
, "REDIRECTDATA TLV"},
379 static inline int ttlv_valid(u_int16_t ttlv
)
382 if (ttlv
== 1 || ttlv
== 0x1000)
384 if (ttlv
>= 0x10 && ttlv
<= 0x11)
386 if (ttlv
>= 0x110 && ttlv
<= 0x116)
405 #define F_ALN_LEN(len) ( ((len)+ForCES_ALNL-1) & ~(ForCES_ALNL-1) )
406 #define GET_TOP_TLV(fhdr) ((struct forces_tlv *)((fhdr) + sizeof (struct forcesh)))
407 #define TLV_SET_LEN(len) (F_ALN_LEN(TLV_HDRL) + (len))
408 #define TLV_ALN_LEN(len) F_ALN_LEN(TLV_SET_LEN(len))
409 #define TLV_RDAT_LEN(tlv) ((int)(EXTRACT_16BITS(&(tlv)->length) - TLV_SET_LEN(0))
410 #define TLV_DATA(tlvp) ((void*)(((char*)(tlvp)) + TLV_SET_LEN(0)))
411 #define GO_NXT_TLV(tlv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_16BITS(&(tlv)->length)), \
412 (struct forces_tlv*)(((char*)(tlv)) \
413 + F_ALN_LEN(EXTRACT_16BITS(&(tlv)->length))))
414 #define ILV_SET_LEN(len) (F_ALN_LEN(ILV_HDRL) + (len))
415 #define ILV_ALN_LEN(len) F_ALN_LEN(ILV_SET_LEN(len))
416 #define ILV_RDAT_LEN(ilv) ((int)(EXTRACT_32BITS(&(ilv)->length)) - ILV_SET_LEN(0))
417 #define ILV_DATA(ilvp) ((void*)(((char*)(ilvp)) + ILV_SET_LEN(0)))
418 #define GO_NXT_ILV(ilv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_32BITS(&(ilv)->length)), \
419 (struct forces_ilv *)(((char*)(ilv)) \
420 + F_ALN_LEN(EXTRACT_32BITS(&(ilv)->length))))
421 #define INVALID_RLEN -1
422 #define INVALID_STLN -2
423 #define INVALID_LTLN -3
424 #define INVALID_ALEN -4
426 static const struct tok ForCES_TLV_err
[] = {
427 {INVALID_RLEN
, "Invalid total length"},
428 {INVALID_STLN
, "xLV too short"},
429 {INVALID_LTLN
, "xLV too long"},
430 {INVALID_ALEN
, "data padding missing"},
434 static inline int tlv_valid(const struct forces_tlv
*tlv
, u_int rlen
)
438 if (EXTRACT_16BITS(&tlv
->length
) < TLV_HDRL
)
440 if (EXTRACT_16BITS(&tlv
->length
) > rlen
)
442 if (rlen
< F_ALN_LEN(EXTRACT_16BITS(&tlv
->length
)))
448 static inline int ilv_valid(const struct forces_ilv
*ilv
, u_int rlen
)
452 if (EXTRACT_32BITS(&ilv
->length
) < ILV_HDRL
)
454 if (EXTRACT_32BITS(&ilv
->length
) > rlen
)
456 if (rlen
< F_ALN_LEN(EXTRACT_32BITS(&ilv
->length
)))
462 static int lfbselect_print(register const u_char
* pptr
, register u_int len
,
463 u_int16_t op_msk
, int indent
);
464 static int redirect_print(register const u_char
* pptr
, register u_int len
,
465 u_int16_t op_msk
, int indent
);
466 static int asrtlv_print(register const u_char
* pptr
, register u_int len
,
467 u_int16_t op_msk
, int indent
);
468 static int asttlv_print(register const u_char
* pptr
, register u_int len
,
469 u_int16_t op_msk
, int indent
);
471 struct forces_lfbsh
{
476 #define ASSNS_OPS (B_OP_REPORT)
477 #define CFG_OPS (B_OP_SET|B_OP_SETPROP|B_OP_DEL|B_OP_COMMIT|B_OP_RTRCOMP)
478 #define CFG_ROPS (B_OP_SETRESP|B_OP_SETPRESP|B_OP_DELRESP|B_OP_RCOMMIT)
479 #define CFG_QY (B_OP_GET|B_OP_GETPROP)
480 #define CFG_QYR (B_OP_GETRESP|B_OP_GETPRESP)
481 #define CFG_EVN (B_OP_REPORT)
483 static const struct tom_h ForCES_msg
[TOM_MAX_IND
+ 1] = {
484 /* TOM_RSV_I */ {TOM_RSVD
, ZERO_TTLV
, 0, "Invalid message", NULL
},
485 /* TOM_ASS_I */ {TOM_ASSNSETUP
, ZERO_MORE_TTLV
| TWO_TLV
, ASSNS_OPS
,
486 "Association Setup", lfbselect_print
},
488 {TOM_ASSNTEARD
, TTLV_T1
, 0, "Association TearDown", asttlv_print
},
489 /* TOM_CFG_I */ {TOM_CONFIG
, TTLV_T2
, CFG_OPS
, "Config", lfbselect_print
},
490 /* TOM_QRY_I */ {TOM_QUERY
, TTLV_T2
, CFG_QY
, "Query", lfbselect_print
},
491 /* TOM_EVN_I */ {TOM_EVENTNOT
, TTLV_T1
, CFG_EVN
, "Event Notification",
494 {TOM_PKTREDIR
, TTLV_T2
, 0, "Packet Redirect", redirect_print
},
495 /* TOM_HBT_I */ {TOM_HEARTBT
, ZERO_TTLV
, 0, "HeartBeat", NULL
},
497 {TOM_ASSNSETREP
, TTLV_T1
, 0, "Association Response", asrtlv_print
},
498 /* TOM_CNR_I */ {TOM_CONFIGREP
, TTLV_T2
, CFG_ROPS
, "Config Response",
501 {TOM_QUERYREP
, TTLV_T2
, CFG_QYR
, "Query Response", lfbselect_print
},
504 static inline const struct tom_h
*get_forces_tom(u_int8_t tom
)
507 for (i
= TOM_RSV_I
; i
<= TOM_MAX_IND
; i
++) {
508 const struct tom_h
*th
= &ForCES_msg
[i
];
512 return &ForCES_msg
[TOM_RSV_I
];
520 int (*print
) (register const u_char
* pptr
, register u_int len
,
521 u_int16_t op_msk
, int indent
);
533 #define PD_MAX_IND (_TOM_RSV_MAX - 1)
535 static inline int pd_valid(u_int16_t pd
)
537 if (pd
>= F_TLV_PDAT
&& pd
<= F_TLV_REST
)
542 static inline void chk_op_type(u_int16_t type
, u_int16_t msk
, u_int16_t omsk
)
544 if (type
!= F_TLV_PDAT
) {
546 if (type
!= F_TLV_KEYI
) {
548 ("Based on flags expected KEYINFO TLV!\n");
553 ("Illegal DATA encoding for type 0x%x programmed %x got %x \n",
562 #define F_SELTABRANGE 2
563 #define F_TABAPPEND 4
571 static int prestlv_print(register const u_char
* pptr
, register u_int len
,
572 u_int16_t op_msk
, int indent
);
573 static int pkeyitlv_print(register const u_char
* pptr
, register u_int len
,
574 u_int16_t op_msk
, int indent
);
575 static int fdatatlv_print(register const u_char
* pptr
, register u_int len
,
576 u_int16_t op_msk
, int indent
);
577 static int sdatatlv_print(register const u_char
* pptr
, register u_int len
,
578 u_int16_t op_msk
, int indent
);
580 static const struct pdata_ops ForCES_pdata
[PD_MAX_IND
+ 1] = {
581 /* PD_RSV_I */ {0, 0, 0, "Invalid message", NULL
},
582 /* PD_SEL_I */ {F_TLV_KEYI
, 0, 0, "KEYINFO TLV", pkeyitlv_print
},
583 /* PD_FDT_I */ {F_TLV_FULD
, 0, B_FULLD
, "FULLDATA TLV", fdatatlv_print
},
584 /* PD_SDT_I */ {F_TLV_SPAD
, 0, B_SPARD
, "SPARSEDATA TLV", sdatatlv_print
},
585 /* PD_RES_I */ {F_TLV_REST
, 0, B_RESTV
, "RESULT TLV", prestlv_print
},
587 {F_TLV_PDAT
, 0, 0, "Inner PATH-DATA TLV", recpdoptlv_print
},
590 static inline const struct pdata_ops
*get_forces_pd(u_int16_t pd
)
593 for (i
= PD_RSV_I
+ 1; i
<= PD_MAX_IND
; i
++) {
594 const struct pdata_ops
*pdo
= &ForCES_pdata
[i
];
598 return &ForCES_pdata
[TOM_RSV_I
];
606 E_INVALID_DESTINATION_PID
,
609 E_LFB_INSTANCE_ID_NOT_FOUND
,
611 E_COMPONENT_DOES_NOT_EXIST
,
615 E_INVALID_ARRAY_CREATION
,
616 E_VALUE_OUT_OF_RANGE
,
618 E_INVALID_PARAMETERS
,
619 E_INVALID_MESSAGE_TYPE
,
626 /* 0x18-0xFE are reserved .. */
627 E_UNSPECIFIED_ERROR
= 0XFF
630 static const struct tok ForCES_errs
[] = {
631 {E_SUCCESS
, "SUCCESS"},
632 {E_INVALID_HEADER
, "INVALID HEADER"},
633 {E_LENGTH_MISMATCH
, "LENGTH MISMATCH"},
634 {E_VERSION_MISMATCH
, "VERSION MISMATCH"},
635 {E_INVALID_DESTINATION_PID
, "INVALID DESTINATION PID"},
636 {E_LFB_UNKNOWN
, "LFB UNKNOWN"},
637 {E_LFB_NOT_FOUND
, "LFB NOT FOUND"},
638 {E_LFB_INSTANCE_ID_NOT_FOUND
, "LFB INSTANCE ID NOT FOUND"},
639 {E_INVALID_PATH
, "INVALID PATH"},
640 {E_COMPONENT_DOES_NOT_EXIST
, "COMPONENT DOES NOT EXIST"},
641 {E_EXISTS
, "EXISTS ALREADY"},
642 {E_NOT_FOUND
, "NOT FOUND"},
643 {E_READ_ONLY
, "READ ONLY"},
644 {E_INVALID_ARRAY_CREATION
, "INVALID ARRAY CREATION"},
645 {E_VALUE_OUT_OF_RANGE
, "VALUE OUT OF RANGE"},
646 {E_CONTENTS_TOO_LONG
, "CONTENTS TOO LONG"},
647 {E_INVALID_PARAMETERS
, "INVALID PARAMETERS"},
648 {E_INVALID_MESSAGE_TYPE
, "INVALID MESSAGE TYPE"},
649 {E_INVALID_FLAGS
, "INVALID FLAGS"},
650 {E_INVALID_TLV
, "INVALID TLV"},
651 {E_EVENT_ERROR
, "EVENT ERROR"},
652 {E_NOT_SUPPORTED
, "NOT SUPPORTED"},
653 {E_MEMORY_ERROR
, "MEMORY ERROR"},
654 {E_INTERNAL_ERROR
, "INTERNAL ERROR"},
655 {E_UNSPECIFIED_ERROR
, "UNSPECIFIED ERROR"},
662 prestlv_print(register const u_char
* pptr
, register u_int len
,
663 u_int16_t op_msk _U_
, int indent
)
665 const struct forces_tlv
*tlv
= (struct forces_tlv
*)pptr
;
666 register const u_char
*tdp
= (u_char
*) TLV_DATA(tlv
);
667 struct res_val
*r
= (struct res_val
*)tdp
;
671 * pdatacnt_print() has ensured that len (the TLV length)
674 dlen
= len
- TLV_HDRL
;
675 if (dlen
!= RESLEN
) {
676 printf("illegal RESULT-TLV: %d bytes!\n", dlen
);
681 if (r
->result
>= 0x18 && r
->result
<= 0xFE) {
682 printf("illegal reserved result code: 0x%x!\n", r
->result
);
687 char *ib
= indent_pr(indent
, 0);
688 printf("%s Result: %s (code 0x%x)\n", ib
,
689 tok2str(ForCES_errs
, NULL
, r
->result
), r
->result
);
694 fputs("[|forces]", stdout
);
699 fdatatlv_print(register const u_char
* pptr
, register u_int len
,
700 u_int16_t op_msk _U_
, int indent
)
702 const struct forces_tlv
*tlv
= (struct forces_tlv
*)pptr
;
704 register const u_char
*tdp
= (u_char
*) TLV_DATA(tlv
);
708 * pdatacnt_print() or pkeyitlv_print() has ensured that len
709 * (the TLV length) >= TLV_HDRL.
711 rlen
= len
- TLV_HDRL
;
713 type
= EXTRACT_16BITS(&tlv
->type
);
714 if (type
!= F_TLV_FULD
) {
715 printf("Error: expecting FULLDATA!\n");
720 char *ib
= indent_pr(indent
+ 2, 1);
721 printf("%s[", &ib
[1]);
722 hex_print_with_offset(ib
, tdp
, rlen
, 0);
723 printf("\n%s]\n", &ib
[1]);
728 fputs("[|forces]", stdout
);
733 sdatailv_print(register const u_char
* pptr
, register u_int len
,
734 u_int16_t op_msk _U_
, int indent
)
737 const struct forces_ilv
*ilv
= (struct forces_ilv
*)pptr
;
740 if (len
< ILV_HDRL
) {
741 printf("Error: BAD SPARSEDATA-TLV!\n");
748 printf("Jamal - outstanding length <%d>\n", rlen
);
750 char *ib
= indent_pr(indent
, 1);
751 register const u_char
*tdp
= (u_char
*) ILV_DATA(ilv
);
753 invilv
= ilv_valid(ilv
, rlen
);
755 printf("%s[", &ib
[1]);
756 hex_print_with_offset(ib
, tdp
, rlen
, 0);
757 printf("\n%s]\n", &ib
[1]);
761 int ilvl
= EXTRACT_32BITS(&ilv
->length
);
762 printf("\n%s ILV: type %x length %d\n", &ib
[1],
763 EXTRACT_32BITS(&ilv
->type
), ilvl
);
764 hex_print_with_offset("\t\t[", tdp
, ilvl
-ILV_HDRL
, 0);
767 ilv
= GO_NXT_ILV(ilv
, rlen
);
773 fputs("[|forces]", stdout
);
778 sdatatlv_print(register const u_char
* pptr
, register u_int len
,
779 u_int16_t op_msk
, int indent
)
781 const struct forces_tlv
*tlv
= (struct forces_tlv
*)pptr
;
783 register const u_char
*tdp
= (u_char
*) TLV_DATA(tlv
);
787 * pdatacnt_print() has ensured that len (the TLV length)
790 rlen
= len
- TLV_HDRL
;
792 type
= EXTRACT_16BITS(&tlv
->type
);
793 if (type
!= F_TLV_SPAD
) {
794 printf("Error: expecting SPARSEDATA!\n");
798 return sdatailv_print(tdp
, rlen
, op_msk
, indent
);
801 fputs("[|forces]", stdout
);
806 pkeyitlv_print(register const u_char
* pptr
, register u_int len
,
807 u_int16_t op_msk
, int indent
)
809 const struct forces_tlv
*tlv
= (struct forces_tlv
*)pptr
;
810 register const u_char
*tdp
= (u_char
*) TLV_DATA(tlv
);
811 register const u_char
*dp
= tdp
+ 4;
812 const struct forces_tlv
*kdtlv
= (struct forces_tlv
*)dp
;
814 char *ib
= indent_pr(indent
, 0);
819 id
= EXTRACT_32BITS(tdp
);
820 printf("%sKeyinfo: Key 0x%x\n", ib
, id
);
822 type
= EXTRACT_16BITS(&kdtlv
->type
);
823 invtlv
= tlv_valid(kdtlv
, len
);
826 printf("%s TLV type 0x%x len %d\n",
827 tok2str(ForCES_TLV_err
, NULL
, invtlv
), type
,
828 EXTRACT_16BITS(&kdtlv
->length
));
832 * At this point, tlv_valid() has ensured that the TLV
833 * length is large enough but not too large (it doesn't
834 * go past the end of the containing TLV).
836 tll
= EXTRACT_16BITS(&kdtlv
->length
);
837 dp
= (u_char
*) TLV_DATA(kdtlv
);
838 return fdatatlv_print(dp
, tll
, op_msk
, indent
);
841 fputs("[|forces]", stdout
);
845 #define PTH_DESC_SIZE 12
848 pdatacnt_print(register const u_char
* pptr
, register u_int len
,
849 u_int16_t IDcnt
, u_int16_t op_msk
, int indent
)
853 char *ib
= indent_pr(indent
, 0);
855 if ((op_msk
& B_APPND
) && vflag
>= 3) {
856 printf("%sTABLE APPEND\n", ib
);
858 for (i
= 0; i
< IDcnt
; i
++) {
862 id
= EXTRACT_32BITS(pptr
);
864 printf("%sID#%02u: %d\n", ib
, i
+ 1, id
);
869 if ((op_msk
& B_TRNG
) || (op_msk
& B_KEYIN
)) {
870 if (op_msk
& B_TRNG
) {
871 u_int32_t starti
, endi
;
873 if (len
< PTH_DESC_SIZE
) {
874 printf("pathlength %d with key/range too short %d\n",
879 pptr
+= sizeof(struct forces_tlv
);
880 len
-= sizeof(struct forces_tlv
);
882 starti
= EXTRACT_32BITS(pptr
);
886 endi
= EXTRACT_32BITS(pptr
);
891 printf("%sTable range: [%d,%d]\n", ib
, starti
, endi
);
894 if (op_msk
& B_KEYIN
) {
895 struct forces_tlv
*keytlv
;
898 if (len
< PTH_DESC_SIZE
) {
899 printf("pathlength %d with key/range too short %d\n",
907 keytlv
= (struct forces_tlv
*)pptr
;
909 pptr
+= sizeof(struct forces_tlv
);
910 len
-= sizeof(struct forces_tlv
);
911 /* skip key content */
912 tll
= EXTRACT_16BITS(&keytlv
->length
);
913 if (tll
< TLV_HDRL
) {
914 printf("key content length %u < %u\n",
920 printf("key content too short\n");
930 const struct forces_tlv
*pdtlv
= (struct forces_tlv
*)pptr
;
938 type
= EXTRACT_16BITS(&pdtlv
->type
);
939 invtlv
= tlv_valid(pdtlv
, len
);
942 ("%s Outstanding bytes %d for TLV type 0x%x TLV len %d\n",
943 tok2str(ForCES_TLV_err
, NULL
, invtlv
), len
, type
,
944 EXTRACT_16BITS(&pdtlv
->length
));
948 * At this point, tlv_valid() has ensured that the TLV
949 * length is large enough but not too large (it doesn't
950 * go past the end of the containing TLV).
952 tll
= EXTRACT_16BITS(&pdtlv
->length
) - TLV_HDRL
;
953 aln
= F_ALN_LEN(EXTRACT_16BITS(&pdtlv
->length
));
954 if (aln
> EXTRACT_16BITS(&pdtlv
->length
)) {
957 ("Invalid padded pathdata TLV type 0x%x len %d missing %d pad bytes\n",
958 type
, EXTRACT_16BITS(&pdtlv
->length
), aln
- len
);
960 pad
= aln
- EXTRACT_16BITS(&pdtlv
->length
);
963 if (pd_valid(type
)) {
964 const struct pdata_ops
*ops
= get_forces_pd(type
);
966 if (vflag
>= 3 && ops
->v
!= F_TLV_PDAT
) {
969 ("%s %s (Length %d DataLen %d pad %d Bytes)\n",
970 ib
, ops
->s
, EXTRACT_16BITS(&pdtlv
->length
),
974 ("%s %s (Length %d DataLen %d Bytes)\n",
975 ib
, ops
->s
, EXTRACT_16BITS(&pdtlv
->length
),
979 chk_op_type(type
, op_msk
, ops
->op_msk
);
981 if (ops
->print((const u_char
*)pdtlv
,
982 tll
+ pad
+ TLV_HDRL
, op_msk
,
985 len
-= (TLV_HDRL
+ pad
+ tll
);
987 printf("Invalid path data content type 0x%x len %d\n",
988 type
, EXTRACT_16BITS(&pdtlv
->length
));
990 if (EXTRACT_16BITS(&pdtlv
->length
)) {
991 hex_print_with_offset("Bad Data val\n\t [",
1002 fputs("[|forces]", stdout
);
1007 pdata_print(register const u_char
* pptr
, register u_int len
,
1008 u_int16_t op_msk
, int indent
)
1010 const struct pathdata_h
*pdh
= (struct pathdata_h
*)pptr
;
1011 char *ib
= indent_pr(indent
, 0);
1014 u_int16_t idcnt
= 0;
1017 if (len
< sizeof(struct pathdata_h
))
1020 printf("\n%sPathdata: Flags 0x%x ID count %d\n",
1021 ib
, EXTRACT_16BITS(&pdh
->pflags
), EXTRACT_16BITS(&pdh
->pIDcnt
));
1024 if (EXTRACT_16BITS(&pdh
->pflags
) & F_SELKEY
) {
1028 /* Table GET Range operation */
1029 if (EXTRACT_16BITS(&pdh
->pflags
) & F_SELTABRANGE
) {
1032 /* Table SET append operation */
1033 if (EXTRACT_16BITS(&pdh
->pflags
) & F_TABAPPEND
) {
1037 pptr
+= sizeof(struct pathdata_h
);
1038 len
-= sizeof(struct pathdata_h
);
1039 idcnt
= EXTRACT_16BITS(&pdh
->pIDcnt
);
1040 minsize
= idcnt
* 4;
1041 if (len
< minsize
) {
1042 printf("\t\t\ttruncated IDs expected %uB got %uB\n", minsize
,
1044 hex_print_with_offset("\t\t\tID Data[", pptr
, len
, 0);
1049 if ((op_msk
& B_TRNG
) && (op_msk
& B_KEYIN
)) {
1050 printf("\t\t\tIllegal to have both Table ranges and keys\n");
1054 more_pd
= pdatacnt_print(pptr
, len
, idcnt
, op_msk
, indent
);
1056 int consumed
= len
- more_pd
;
1059 /* XXX: Argh, recurse some more */
1060 return recpdoptlv_print(pptr
, len
, op_msk
, indent
+1);
1065 fputs("[|forces]", stdout
);
1070 genoptlv_print(register const u_char
* pptr
, register u_int len
,
1071 u_int16_t op_msk
, int indent
)
1073 const struct forces_tlv
*pdtlv
= (struct forces_tlv
*)pptr
;
1077 char *ib
= indent_pr(indent
, 0);
1080 type
= EXTRACT_16BITS(&pdtlv
->type
);
1081 tll
= EXTRACT_16BITS(&pdtlv
->length
) - TLV_HDRL
;
1082 invtlv
= tlv_valid(pdtlv
, len
);
1083 printf("genoptlvprint - %s TLV type 0x%x len %d\n",
1084 tok2str(ForCES_TLV
, NULL
, type
), type
, EXTRACT_16BITS(&pdtlv
->length
));
1087 * At this point, tlv_valid() has ensured that the TLV
1088 * length is large enough but not too large (it doesn't
1089 * go past the end of the containing TLV).
1091 register const u_char
*dp
= (u_char
*) TLV_DATA(pdtlv
);
1092 if (!ttlv_valid(type
)) {
1093 printf("%s TLV type 0x%x len %d\n",
1094 tok2str(ForCES_TLV_err
, NULL
, invtlv
), type
,
1095 EXTRACT_16BITS(&pdtlv
->length
));
1099 printf("%s%s, length %d (data length %d Bytes)",
1100 ib
, tok2str(ForCES_TLV
, NULL
, type
),
1101 EXTRACT_16BITS(&pdtlv
->length
), tll
);
1103 return pdata_print(dp
, tll
, op_msk
, indent
+ 1);
1105 printf("\t\t\tInvalid ForCES TLV type=%x", type
);
1110 fputs("[|forces]", stdout
);
1115 recpdoptlv_print(register const u_char
* pptr
, register u_int len
,
1116 u_int16_t op_msk
, int indent
)
1118 const struct forces_tlv
*pdtlv
= (struct forces_tlv
*)pptr
;
1122 register const u_char
*dp
;
1127 invtlv
= tlv_valid(pdtlv
, len
);
1133 * At this point, tlv_valid() has ensured that the TLV
1134 * length is large enough but not too large (it doesn't
1135 * go past the end of the containing TLV).
1137 ib
= indent_pr(indent
, 0);
1138 type
= EXTRACT_16BITS(&pdtlv
->type
);
1139 dp
= (u_char
*) TLV_DATA(pdtlv
);
1140 tll
= EXTRACT_16BITS(&pdtlv
->length
) - TLV_HDRL
;
1144 ("%s%s, length %d (data encapsulated %d Bytes)",
1145 ib
, tok2str(ForCES_TLV
, NULL
, type
),
1146 EXTRACT_16BITS(&pdtlv
->length
),
1147 EXTRACT_16BITS(&pdtlv
->length
) - TLV_HDRL
);
1149 if (pdata_print(dp
, tll
, op_msk
, indent
+ 1) == -1)
1151 pdtlv
= GO_NXT_TLV(pdtlv
, len
);
1156 ("\n\t\tMessy PATHDATA TLV header, type (0x%x)\n\t\texcess of %d Bytes ",
1157 EXTRACT_16BITS(&pdtlv
->type
), len
- EXTRACT_16BITS(&pdtlv
->length
));
1164 fputs("[|forces]", stdout
);
1169 invoptlv_print(register const u_char
* pptr
, register u_int len
,
1170 u_int16_t op_msk _U_
, int indent
)
1172 char *ib
= indent_pr(indent
, 1);
1175 printf("%sData[", &ib
[1]);
1176 hex_print_with_offset(ib
, pptr
, len
, 0);
1177 printf("%s]\n", ib
);
1183 otlv_print(const struct forces_tlv
*otlv
, u_int16_t op_msk _U_
, int indent
)
1186 register const u_char
*dp
= (u_char
*) TLV_DATA(otlv
);
1189 char *ib
= indent_pr(indent
, 0);
1190 const struct optlv_h
*ops
;
1193 * lfbselect_print() has ensured that EXTRACT_16BITS(&otlv->length)
1197 type
= EXTRACT_16BITS(&otlv
->type
);
1198 tll
= EXTRACT_16BITS(&otlv
->length
) - TLV_HDRL
;
1199 ops
= get_forces_optlv_h(type
);
1201 printf("%sOper TLV %s(0x%x) length %d\n", ib
, ops
->s
, type
,
1202 EXTRACT_16BITS(&otlv
->length
));
1204 /* empty TLVs like COMMIT and TRCOMMIT are empty, we stop here .. */
1205 if (!ops
->flags
& ZERO_TTLV
) {
1206 if (tll
!= 0) /* instead of "if (tll)" - for readability .. */
1207 printf("%s: Illegal - MUST be empty\n", ops
->s
);
1210 /* rest of ops must at least have 12B {pathinfo} */
1211 if (tll
< OP_MIN_SIZ
) {
1212 printf("\t\tOper TLV %s(0x%x) length %d\n", ops
->s
, type
,
1213 EXTRACT_16BITS(&otlv
->length
));
1214 printf("\t\tTruncated data size %d minimum required %d\n", tll
,
1216 return invoptlv_print(dp
, tll
, ops
->op_msk
, indent
);
1220 rc
= ops
->print(dp
, tll
, ops
->op_msk
, indent
+ 1);
1224 fputs("[|forces]", stdout
);
1231 asttlv_print(register const u_char
* pptr
, register u_int len
,
1232 u_int16_t op_msk _U_
, int indent
)
1236 char *ib
= indent_pr(indent
, 0);
1239 * forces_type_print() has ensured that len (the TLV length)
1242 dlen
= len
- TLV_HDRL
;
1243 if (dlen
!= ASTDLN
) {
1244 printf("illegal ASTresult-TLV: %d bytes!\n", dlen
);
1248 rescode
= EXTRACT_32BITS(pptr
);
1249 if (rescode
> ASTMCD
) {
1250 printf("illegal ASTresult result code: %d!\n", rescode
);
1255 printf("Teardown reason:\n%s", ib
);
1258 printf("Normal Teardown");
1261 printf("Loss of Heartbeats");
1264 printf("Out of bandwidth");
1267 printf("Out of Memory");
1270 printf("Application Crash");
1273 printf("Unknown Teardown reason");
1276 printf("(%x)\n%s", rescode
, ib
);
1281 fputs("[|forces]", stdout
);
1288 asrtlv_print(register const u_char
* pptr
, register u_int len
,
1289 u_int16_t op_msk _U_
, int indent
)
1293 char *ib
= indent_pr(indent
, 0);
1296 * forces_type_print() has ensured that len (the TLV length)
1299 dlen
= len
- TLV_HDRL
;
1300 if (dlen
!= ASRDLN
) { /* id, instance, oper tlv */
1301 printf("illegal ASRresult-TLV: %d bytes!\n", dlen
);
1305 rescode
= EXTRACT_32BITS(pptr
);
1307 if (rescode
> ASRMCD
) {
1308 printf("illegal ASRresult result code: %d!\n", rescode
);
1319 printf("FE ID invalid ");
1322 printf("permission denied ");
1328 printf("(%x)\n%s", rescode
, ib
);
1333 fputs("[|forces]", stdout
);
1342 gentltlv_print(register const u_char
* pptr _U_
, register u_int len
,
1343 u_int16_t op_msk _U_
, int indent _U_
)
1345 u_int dlen
= len
- TLV_HDRL
;
1347 if (dlen
< 4) { /* at least 32 bits must exist */
1348 printf("truncated TLV: %d bytes missing! ", 4 - dlen
);
1358 print_metailv(register const u_char
* pptr
, register u_int len
,
1359 u_int16_t op_msk _U_
, int indent
)
1363 char *ib
= indent_pr(indent
, 0);
1364 /* XXX: check header length */
1365 const struct forces_ilv
*ilv
= (struct forces_ilv
*)pptr
;
1368 * print_metatlv() has ensured that len (what remains in the
1371 rlen
= EXTRACT_32BITS(&ilv
->length
) - ILV_HDRL
;
1373 printf("%sMetaID 0x%x length %d\n", ib
, EXTRACT_32BITS(&ilv
->type
),
1374 EXTRACT_32BITS(&ilv
->length
));
1376 hex_print_with_offset("\t\t[", ILV_DATA(ilv
), rlen
, 0);
1382 fputs("[|forces]", stdout
);
1387 print_metatlv(register const u_char
* pptr
, register u_int len
,
1388 u_int16_t op_msk _U_
, int indent
)
1391 char *ib
= indent_pr(indent
, 0);
1393 const struct forces_ilv
*ilv
= (struct forces_ilv
*)pptr
;
1397 * redirect_print() has ensured that len (what remains in the
1400 dlen
= len
- TLV_HDRL
;
1402 printf("\n%s METADATA length %d \n", ib
, rlen
);
1405 invilv
= ilv_valid(ilv
, rlen
);
1411 * At this point, ilv_valid() has ensured that the ILV
1412 * length is large enough but not too large (it doesn't
1413 * go past the end of the containing TLV).
1415 print_metailv((u_char
*) ilv
, rlen
, 0, indent
+ 1);
1416 ilv
= GO_NXT_ILV(ilv
, rlen
);
1422 fputs("[|forces]", stdout
);
1428 print_reddata(register const u_char
* pptr
, register u_int len
,
1429 u_int16_t op_msk _U_
, int indent _U_
)
1432 char *ib
= indent_pr(indent
, 0);
1435 dlen
= len
- TLV_HDRL
;
1437 printf("\n%s Redirect Data length %d \n", ib
, rlen
);
1441 hex_print_with_offset("\n\t\t", pptr
, rlen
, 0);
1449 redirect_print(register const u_char
* pptr
, register u_int len
,
1450 u_int16_t op_msk _U_
, int indent
)
1452 const struct forces_tlv
*tlv
= (struct forces_tlv
*)pptr
;
1458 * forces_type_print() has ensured that len (the TLV length)
1461 dlen
= len
- TLV_HDRL
;
1462 if (dlen
<= RD_MIN
) {
1463 printf("\n\t\ttruncated Redirect TLV: %d bytes missing! ",
1472 invtlv
= tlv_valid(tlv
, rlen
);
1474 printf("Bad Redirect data\n");
1479 * At this point, tlv_valid() has ensured that the TLV
1480 * length is large enough but not too large (it doesn't
1481 * go past the end of the containing TLV).
1483 if (EXTRACT_16BITS(&tlv
->type
) == F_TLV_METD
) {
1484 print_metatlv((u_char
*) TLV_DATA(tlv
),
1485 EXTRACT_16BITS(&tlv
->length
), 0, indent
);
1486 } else if ((EXTRACT_16BITS(&tlv
->type
) == F_TLV_REDD
)) {
1487 print_reddata((u_char
*) TLV_DATA(tlv
),
1488 EXTRACT_16BITS(&tlv
->length
), 0, indent
);
1490 printf("Unknown REDIRECT TLV 0x%x len %d\n",
1491 EXTRACT_16BITS(&tlv
->type
),
1492 EXTRACT_16BITS(&tlv
->length
));
1495 tlv
= GO_NXT_TLV(tlv
, rlen
);
1500 ("\n\t\tMessy Redirect TLV header, type (0x%x)\n\t\texcess of %d Bytes ",
1501 EXTRACT_16BITS(&tlv
->type
),
1502 rlen
- EXTRACT_16BITS(&tlv
->length
));
1509 fputs("[|forces]", stdout
);
1517 lfbselect_print(register const u_char
* pptr
, register u_int len
,
1518 u_int16_t op_msk
, int indent
)
1520 const struct forces_lfbsh
*lfbs
;
1521 const struct forces_tlv
*otlv
;
1522 char *ib
= indent_pr(indent
, 0);
1528 * forces_type_print() has ensured that len (the TLV length)
1531 dlen
= len
- TLV_HDRL
;
1532 if (dlen
<= OP_MIN
) { /* id, instance, oper tlv header .. */
1533 printf("\n\t\ttruncated lfb selector: %d bytes missing! ",
1539 * At this point, we know that dlen > OP_MIN; OP_OFF < OP_MIN, so
1540 * we also know that it's > OP_OFF.
1542 rlen
= dlen
- OP_OFF
;
1544 lfbs
= (const struct forces_lfbsh
*)pptr
;
1547 printf("\n%s%s(Classid %x) instance %x\n",
1548 ib
, tok2str(ForCES_LFBs
, NULL
, EXTRACT_32BITS(&lfbs
->class)),
1549 EXTRACT_32BITS(&lfbs
->class),
1550 EXTRACT_32BITS(&lfbs
->instance
));
1553 otlv
= (struct forces_tlv
*)(lfbs
+ 1);
1558 invtlv
= tlv_valid(otlv
, rlen
);
1563 * At this point, tlv_valid() has ensured that the TLV
1564 * length is large enough but not too large (it doesn't
1565 * go past the end of the containing TLV).
1567 if (op_valid(EXTRACT_16BITS(&otlv
->type
), op_msk
)) {
1568 otlv_print(otlv
, 0, indent
);
1573 ("\t\tINValid oper-TLV type 0x%x length %d for this ForCES message\n",
1574 EXTRACT_16BITS(&otlv
->type
), EXTRACT_16BITS(&otlv
->length
));
1575 invoptlv_print((u_char
*)otlv
, rlen
, 0, indent
);
1577 otlv
= GO_NXT_TLV(otlv
, rlen
);
1582 ("\n\t\tMessy oper TLV header, type (0x%x)\n\t\texcess of %d Bytes ",
1583 EXTRACT_16BITS(&otlv
->type
), rlen
- EXTRACT_16BITS(&otlv
->length
));
1590 fputs("[|forces]", stdout
);
1595 forces_type_print(register const u_char
* pptr
, const struct forcesh
*fhdr _U_
,
1596 register u_int mlen
, const struct tom_h
*tops
)
1598 const struct forces_tlv
*tltlv
;
1605 * forces_print() has already checked that mlen >= ForCES_HDRL
1606 * by calling ForCES_HLN_VALID().
1608 rlen
= mlen
- ForCES_HDRL
;
1610 if (rlen
> TLV_HLN
) {
1611 if (tops
->flags
& ZERO_TTLV
) {
1612 printf("<0x%x>Illegal Top level TLV!\n", tops
->flags
);
1616 if (tops
->flags
& ZERO_MORE_TTLV
)
1618 if (tops
->flags
& ONE_MORE_TTLV
) {
1619 printf("\tTop level TLV Data missing!\n");
1624 if (tops
->flags
& ZERO_TTLV
) {
1628 ttlv
= tops
->flags
>> 4;
1629 tltlv
= GET_TOP_TLV(pptr
);
1631 /*XXX: 15 top level tlvs will probably be fine
1632 You are nuts if you send more ;-> */
1635 invtlv
= tlv_valid(tltlv
, rlen
);
1640 * At this point, tlv_valid() has ensured that the TLV
1641 * length is large enough but not too large (it doesn't
1642 * go past the end of the packet).
1644 if (!ttlv_valid(EXTRACT_16BITS(&tltlv
->type
))) {
1645 printf("\n\tInvalid ForCES Top TLV type=0x%x",
1646 EXTRACT_16BITS(&tltlv
->type
));
1651 printf("\t%s, length %d (data length %d Bytes)",
1652 tok2str(ForCES_TLV
, NULL
, EXTRACT_16BITS(&tltlv
->type
)),
1653 EXTRACT_16BITS(&tltlv
->length
),
1654 EXTRACT_16BITS(&tltlv
->length
) - TLV_HDRL
);
1656 rc
= tops
->print((u_char
*) TLV_DATA(tltlv
),
1657 EXTRACT_16BITS(&tltlv
->length
), tops
->op_msk
, 9);
1661 tltlv
= GO_NXT_TLV(tltlv
, rlen
);
1667 * XXX - if ttlv != 0, does that mean that the packet was too
1668 * short, and didn't have *enough* TLVs in it?
1671 printf("\tMess TopTLV header: min %u, total %d advertised %d ",
1672 TLV_HDRL
, rlen
, EXTRACT_16BITS(&tltlv
->length
));
1679 fputs("[|forces]", stdout
);
1684 forces_print(register const u_char
* pptr
, register u_int len
)
1686 const struct forcesh
*fhdr
;
1689 const struct tom_h
*tops
;
1692 fhdr
= (const struct forcesh
*)pptr
;
1694 if (!tom_valid(fhdr
->fm_tom
)) {
1695 printf("Invalid ForCES message type %d\n", fhdr
->fm_tom
);
1699 mlen
= ForCES_BLN(fhdr
);
1701 tops
= get_forces_tom(fhdr
->fm_tom
);
1702 if (tops
->v
== TOM_RSVD
) {
1703 printf("\n\tUnknown ForCES message type=0x%x", fhdr
->fm_tom
);
1707 printf("\n\tForCES %s ", tops
->s
);
1708 if (!ForCES_HLN_VALID(mlen
, len
)) {
1710 ("Illegal ForCES pkt len - min %u, total recvd %d, advertised %d ",
1711 ForCES_HDRL
, len
, ForCES_BLN(fhdr
));
1715 TCHECK2(*(pptr
+ 20), 4);
1716 flg_raw
= EXTRACT_32BITS(pptr
+ 20);
1718 printf("\n\tForCES Version %d len %uB flags 0x%08x ",
1719 ForCES_V(fhdr
), mlen
, flg_raw
);
1720 printf("\n\tSrcID 0x%x(%s) DstID 0x%x(%s) Correlator 0x%" PRIx64
,
1721 ForCES_SID(fhdr
), ForCES_node(ForCES_SID(fhdr
)),
1722 ForCES_DID(fhdr
), ForCES_node(ForCES_DID(fhdr
)),
1723 EXTRACT_64BITS(fhdr
->fm_cor
));
1728 ("\n\tForCES flags:\n\t %s(0x%x), prio=%d, %s(0x%x),\n\t %s(0x%x), %s(0x%x)\n",
1729 ForCES_ACKp(ForCES_ACK(fhdr
)), ForCES_ACK(fhdr
),
1731 ForCES_EMp(ForCES_EM(fhdr
)), ForCES_EM(fhdr
),
1732 ForCES_ATp(ForCES_AT(fhdr
)), ForCES_AT(fhdr
),
1733 ForCES_TPp(ForCES_TP(fhdr
)), ForCES_TP(fhdr
));
1735 ("\t Extra flags: rsv(b5-7) 0x%x rsv(b13-31) 0x%x\n",
1736 ForCES_RS1(fhdr
), ForCES_RS2(fhdr
));
1738 rc
= forces_type_print(pptr
, fhdr
, mlen
, tops
);
1741 hex_print_with_offset("\n\t[", pptr
, len
, 0);
1747 printf("\n\t Raw ForCES message\n\t [");
1748 hex_print_with_offset("\n\t ", pptr
, len
, 0);
1755 fputs("[|forces]", stdout
);