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");
747 //printf("Jamal - outstanding length <%d>\n", rlen);
748 char *ib
= indent_pr(indent
, 1);
749 register const u_char
*tdp
= (u_char
*) ILV_DATA(ilv
);
751 invilv
= ilv_valid(ilv
, rlen
);
753 printf("%s[", &ib
[1]);
754 hex_print_with_offset(ib
, tdp
, rlen
, 0);
755 printf("\n%s]\n", &ib
[1]);
759 int ilvl
= EXTRACT_32BITS(&ilv
->length
);
760 printf("\n%s ILV: type %x length %d\n", &ib
[1],
761 EXTRACT_32BITS(&ilv
->type
), ilvl
);
762 hex_print_with_offset("\t\t[", tdp
, ilvl
-ILV_HDRL
, 0);
765 ilv
= GO_NXT_ILV(ilv
, rlen
);
771 fputs("[|forces]", stdout
);
776 sdatatlv_print(register const u_char
* pptr
, register u_int len
,
777 u_int16_t op_msk
, int indent
)
779 const struct forces_tlv
*tlv
= (struct forces_tlv
*)pptr
;
781 register const u_char
*tdp
= (u_char
*) TLV_DATA(tlv
);
785 * pdatacnt_print() has ensured that len (the TLV length)
788 rlen
= len
- TLV_HDRL
;
790 type
= EXTRACT_16BITS(&tlv
->type
);
791 if (type
!= F_TLV_SPAD
) {
792 printf("Error: expecting SPARSEDATA!\n");
796 return sdatailv_print(tdp
, rlen
, op_msk
, indent
);
799 fputs("[|forces]", stdout
);
804 pkeyitlv_print(register const u_char
* pptr
, register u_int len
,
805 u_int16_t op_msk
, int indent
)
807 const struct forces_tlv
*tlv
= (struct forces_tlv
*)pptr
;
808 register const u_char
*tdp
= (u_char
*) TLV_DATA(tlv
);
809 register const u_char
*dp
= tdp
+ 4;
810 const struct forces_tlv
*kdtlv
= (struct forces_tlv
*)dp
;
812 char *ib
= indent_pr(indent
, 0);
817 id
= EXTRACT_32BITS(tdp
);
818 printf("%sKeyinfo: Key 0x%x\n", ib
, id
);
820 type
= EXTRACT_16BITS(&kdtlv
->type
);
821 invtlv
= tlv_valid(kdtlv
, len
);
824 printf("%s TLV type 0x%x len %d\n",
825 tok2str(ForCES_TLV_err
, NULL
, invtlv
), type
,
826 EXTRACT_16BITS(&kdtlv
->length
));
830 * At this point, tlv_valid() has ensured that the TLV
831 * length is large enough but not too large (it doesn't
832 * go past the end of the containing TLV).
834 tll
= EXTRACT_16BITS(&kdtlv
->length
);
835 dp
= (u_char
*) TLV_DATA(kdtlv
);
836 return fdatatlv_print(dp
, tll
, op_msk
, indent
);
839 fputs("[|forces]", stdout
);
843 #define PTH_DESC_SIZE 12
846 pdatacnt_print(register const u_char
* pptr
, register u_int len
,
847 u_int16_t IDcnt
, u_int16_t op_msk
, int indent
)
851 char *ib
= indent_pr(indent
, 0);
853 if ((op_msk
& B_APPND
) && vflag
>= 3) {
854 printf("%sTABLE APPEND\n", ib
);
856 for (i
= 0; i
< IDcnt
; i
++) {
860 id
= EXTRACT_32BITS(pptr
);
862 printf("%sID#%02u: %d\n", ib
, i
+ 1, id
);
867 if ((op_msk
& B_TRNG
) || (op_msk
& B_KEYIN
)) {
868 if (op_msk
& B_TRNG
) {
869 u_int32_t starti
, endi
;
871 if (len
< PTH_DESC_SIZE
) {
872 printf("pathlength %d with key/range too short %d\n",
877 pptr
+= sizeof(struct forces_tlv
);
878 len
-= sizeof(struct forces_tlv
);
880 starti
= EXTRACT_32BITS(pptr
);
884 endi
= EXTRACT_32BITS(pptr
);
889 printf("%sTable range: [%d,%d]\n", ib
, starti
, endi
);
892 if (op_msk
& B_KEYIN
) {
893 struct forces_tlv
*keytlv
;
896 if (len
< PTH_DESC_SIZE
) {
897 printf("pathlength %d with key/range too short %d\n",
905 keytlv
= (struct forces_tlv
*)pptr
;
907 pptr
+= sizeof(struct forces_tlv
);
908 len
-= sizeof(struct forces_tlv
);
909 /* skip key content */
910 tll
= EXTRACT_16BITS(&keytlv
->length
);
911 if (tll
< TLV_HDRL
) {
912 printf("key content length %u < %u\n",
918 printf("key content too short\n");
928 const struct forces_tlv
*pdtlv
= (struct forces_tlv
*)pptr
;
936 type
= EXTRACT_16BITS(&pdtlv
->type
);
937 invtlv
= tlv_valid(pdtlv
, len
);
940 ("%s Outstanding bytes %d for TLV type 0x%x TLV len %d\n",
941 tok2str(ForCES_TLV_err
, NULL
, invtlv
), len
, type
,
942 EXTRACT_16BITS(&pdtlv
->length
));
946 * At this point, tlv_valid() has ensured that the TLV
947 * length is large enough but not too large (it doesn't
948 * go past the end of the containing TLV).
950 tll
= EXTRACT_16BITS(&pdtlv
->length
) - TLV_HDRL
;
951 aln
= F_ALN_LEN(EXTRACT_16BITS(&pdtlv
->length
));
952 if (aln
> EXTRACT_16BITS(&pdtlv
->length
)) {
955 ("Invalid padded pathdata TLV type 0x%x len %d missing %d pad bytes\n",
956 type
, EXTRACT_16BITS(&pdtlv
->length
), aln
- len
);
958 pad
= aln
- EXTRACT_16BITS(&pdtlv
->length
);
961 if (pd_valid(type
)) {
962 const struct pdata_ops
*ops
= get_forces_pd(type
);
964 if (vflag
>= 3 && ops
->v
!= F_TLV_PDAT
) {
967 ("%s %s (Length %d DataLen %d pad %d Bytes)\n",
968 ib
, ops
->s
, EXTRACT_16BITS(&pdtlv
->length
),
972 ("%s %s (Length %d DataLen %d Bytes)\n",
973 ib
, ops
->s
, EXTRACT_16BITS(&pdtlv
->length
),
977 chk_op_type(type
, op_msk
, ops
->op_msk
);
979 if (ops
->print((const u_char
*)pdtlv
,
980 tll
+ pad
+ TLV_HDRL
, op_msk
,
983 len
-= (TLV_HDRL
+ pad
+ tll
);
985 printf("Invalid path data content type 0x%x len %d\n",
986 type
, EXTRACT_16BITS(&pdtlv
->length
));
988 if (EXTRACT_16BITS(&pdtlv
->length
)) {
989 hex_print_with_offset("Bad Data val\n\t [",
1000 fputs("[|forces]", stdout
);
1005 pdata_print(register const u_char
* pptr
, register u_int len
,
1006 u_int16_t op_msk
, int indent
)
1008 const struct pathdata_h
*pdh
= (struct pathdata_h
*)pptr
;
1009 char *ib
= indent_pr(indent
, 0);
1012 u_int16_t idcnt
= 0;
1015 if (len
< sizeof(struct pathdata_h
))
1018 printf("\n%sPathdata: Flags 0x%x ID count %d\n",
1019 ib
, EXTRACT_16BITS(&pdh
->pflags
), EXTRACT_16BITS(&pdh
->pIDcnt
));
1022 if (EXTRACT_16BITS(&pdh
->pflags
) & F_SELKEY
) {
1026 /* Table GET Range operation */
1027 if (EXTRACT_16BITS(&pdh
->pflags
) & F_SELTABRANGE
) {
1030 /* Table SET append operation */
1031 if (EXTRACT_16BITS(&pdh
->pflags
) & F_TABAPPEND
) {
1035 pptr
+= sizeof(struct pathdata_h
);
1036 len
-= sizeof(struct pathdata_h
);
1037 idcnt
= EXTRACT_16BITS(&pdh
->pIDcnt
);
1038 minsize
= idcnt
* 4;
1039 if (len
< minsize
) {
1040 printf("\t\t\ttruncated IDs expected %uB got %uB\n", minsize
,
1042 hex_print_with_offset("\t\t\tID Data[", pptr
, len
, 0);
1047 if ((op_msk
& B_TRNG
) && (op_msk
& B_KEYIN
)) {
1048 printf("\t\t\tIllegal to have both Table ranges and keys\n");
1052 more_pd
= pdatacnt_print(pptr
, len
, idcnt
, op_msk
, indent
);
1054 int consumed
= len
- more_pd
;
1057 /* XXX: Argh, recurse some more */
1058 return recpdoptlv_print(pptr
, len
, op_msk
, indent
+1);
1063 fputs("[|forces]", stdout
);
1068 genoptlv_print(register const u_char
* pptr
, register u_int len
,
1069 u_int16_t op_msk
, int indent
)
1071 const struct forces_tlv
*pdtlv
= (struct forces_tlv
*)pptr
;
1075 char *ib
= indent_pr(indent
, 0);
1078 type
= EXTRACT_16BITS(&pdtlv
->type
);
1079 tll
= EXTRACT_16BITS(&pdtlv
->length
) - TLV_HDRL
;
1080 invtlv
= tlv_valid(pdtlv
, len
);
1081 printf("genoptlvprint - %s TLV type 0x%x len %d\n",
1082 tok2str(ForCES_TLV
, NULL
, type
), type
, EXTRACT_16BITS(&pdtlv
->length
));
1085 * At this point, tlv_valid() has ensured that the TLV
1086 * length is large enough but not too large (it doesn't
1087 * go past the end of the containing TLV).
1089 register const u_char
*dp
= (u_char
*) TLV_DATA(pdtlv
);
1090 if (!ttlv_valid(type
)) {
1091 printf("%s TLV type 0x%x len %d\n",
1092 tok2str(ForCES_TLV_err
, NULL
, invtlv
), type
,
1093 EXTRACT_16BITS(&pdtlv
->length
));
1097 printf("%s%s, length %d (data length %d Bytes)",
1098 ib
, tok2str(ForCES_TLV
, NULL
, type
),
1099 EXTRACT_16BITS(&pdtlv
->length
), tll
);
1101 return pdata_print(dp
, tll
, op_msk
, indent
+ 1);
1103 printf("\t\t\tInvalid ForCES TLV type=%x", type
);
1108 fputs("[|forces]", stdout
);
1113 recpdoptlv_print(register const u_char
* pptr
, register u_int len
,
1114 u_int16_t op_msk
, int indent
)
1116 const struct forces_tlv
*pdtlv
= (struct forces_tlv
*)pptr
;
1120 register const u_char
*dp
;
1125 invtlv
= tlv_valid(pdtlv
, len
);
1131 * At this point, tlv_valid() has ensured that the TLV
1132 * length is large enough but not too large (it doesn't
1133 * go past the end of the containing TLV).
1135 ib
= indent_pr(indent
, 0);
1136 type
= EXTRACT_16BITS(&pdtlv
->type
);
1137 dp
= (u_char
*) TLV_DATA(pdtlv
);
1138 tll
= EXTRACT_16BITS(&pdtlv
->length
) - TLV_HDRL
;
1142 ("%s%s, length %d (data encapsulated %d Bytes)",
1143 ib
, tok2str(ForCES_TLV
, NULL
, type
),
1144 EXTRACT_16BITS(&pdtlv
->length
),
1145 EXTRACT_16BITS(&pdtlv
->length
) - TLV_HDRL
);
1147 if (pdata_print(dp
, tll
, op_msk
, indent
+ 1) == -1)
1149 pdtlv
= GO_NXT_TLV(pdtlv
, len
);
1154 ("\n\t\tMessy PATHDATA TLV header, type (0x%x)\n\t\texcess of %d Bytes ",
1155 EXTRACT_16BITS(&pdtlv
->type
), len
- EXTRACT_16BITS(&pdtlv
->length
));
1162 fputs("[|forces]", stdout
);
1167 invoptlv_print(register const u_char
* pptr
, register u_int len
,
1168 u_int16_t op_msk _U_
, int indent
)
1170 char *ib
= indent_pr(indent
, 1);
1173 printf("%sData[", &ib
[1]);
1174 hex_print_with_offset(ib
, pptr
, len
, 0);
1175 printf("%s]\n", ib
);
1181 otlv_print(const struct forces_tlv
*otlv
, u_int16_t op_msk _U_
, int indent
)
1184 register const u_char
*dp
= (u_char
*) TLV_DATA(otlv
);
1187 char *ib
= indent_pr(indent
, 0);
1188 const struct optlv_h
*ops
;
1191 * lfbselect_print() has ensured that EXTRACT_16BITS(&otlv->length)
1195 type
= EXTRACT_16BITS(&otlv
->type
);
1196 tll
= EXTRACT_16BITS(&otlv
->length
) - TLV_HDRL
;
1197 ops
= get_forces_optlv_h(type
);
1199 printf("%sOper TLV %s(0x%x) length %d\n", ib
, ops
->s
, type
,
1200 EXTRACT_16BITS(&otlv
->length
));
1202 /* empty TLVs like COMMIT and TRCOMMIT are empty, we stop here .. */
1203 if (!ops
->flags
& ZERO_TTLV
) {
1204 if (tll
!= 0) /* instead of "if (tll)" - for readability .. */
1205 printf("%s: Illegal - MUST be empty\n", ops
->s
);
1208 /* rest of ops must at least have 12B {pathinfo} */
1209 if (tll
< OP_MIN_SIZ
) {
1210 printf("\t\tOper TLV %s(0x%x) length %d\n", ops
->s
, type
,
1211 EXTRACT_16BITS(&otlv
->length
));
1212 printf("\t\tTruncated data size %d minimum required %d\n", tll
,
1214 return invoptlv_print(dp
, tll
, ops
->op_msk
, indent
);
1218 rc
= ops
->print(dp
, tll
, ops
->op_msk
, indent
+ 1);
1222 fputs("[|forces]", stdout
);
1229 asttlv_print(register const u_char
* pptr
, register u_int len
,
1230 u_int16_t op_msk _U_
, int indent
)
1234 char *ib
= indent_pr(indent
, 0);
1237 * forces_type_print() has ensured that len (the TLV length)
1240 dlen
= len
- TLV_HDRL
;
1241 if (dlen
!= ASTDLN
) {
1242 printf("illegal ASTresult-TLV: %d bytes!\n", dlen
);
1246 rescode
= EXTRACT_32BITS(pptr
);
1247 if (rescode
> ASTMCD
) {
1248 printf("illegal ASTresult result code: %d!\n", rescode
);
1253 printf("Teardown reason:\n%s", ib
);
1256 printf("Normal Teardown");
1259 printf("Loss of Heartbeats");
1262 printf("Out of bandwidth");
1265 printf("Out of Memory");
1268 printf("Application Crash");
1271 printf("Unknown Teardown reason");
1274 printf("(%x)\n%s", rescode
, ib
);
1279 fputs("[|forces]", stdout
);
1286 asrtlv_print(register const u_char
* pptr
, register u_int len
,
1287 u_int16_t op_msk _U_
, int indent
)
1291 char *ib
= indent_pr(indent
, 0);
1294 * forces_type_print() has ensured that len (the TLV length)
1297 dlen
= len
- TLV_HDRL
;
1298 if (dlen
!= ASRDLN
) { /* id, instance, oper tlv */
1299 printf("illegal ASRresult-TLV: %d bytes!\n", dlen
);
1303 rescode
= EXTRACT_32BITS(pptr
);
1305 if (rescode
> ASRMCD
) {
1306 printf("illegal ASRresult result code: %d!\n", rescode
);
1317 printf("FE ID invalid ");
1320 printf("permission denied ");
1326 printf("(%x)\n%s", rescode
, ib
);
1331 fputs("[|forces]", stdout
);
1340 gentltlv_print(register const u_char
* pptr _U_
, register u_int len
,
1341 u_int16_t op_msk _U_
, int indent _U_
)
1343 u_int dlen
= len
- TLV_HDRL
;
1345 if (dlen
< 4) { /* at least 32 bits must exist */
1346 printf("truncated TLV: %d bytes missing! ", 4 - dlen
);
1356 print_metailv(register const u_char
* pptr
, register u_int len
,
1357 u_int16_t op_msk _U_
, int indent
)
1361 char *ib
= indent_pr(indent
, 0);
1362 /* XXX: check header length */
1363 const struct forces_ilv
*ilv
= (struct forces_ilv
*)pptr
;
1366 * print_metatlv() has ensured that len (what remains in the
1369 rlen
= EXTRACT_32BITS(&ilv
->length
) - ILV_HDRL
;
1371 printf("%sMetaID 0x%x length %d\n", ib
, EXTRACT_32BITS(&ilv
->type
),
1372 EXTRACT_32BITS(&ilv
->length
));
1374 hex_print_with_offset("\t\t[", ILV_DATA(ilv
), rlen
, 0);
1380 fputs("[|forces]", stdout
);
1385 print_metatlv(register const u_char
* pptr
, register u_int len
,
1386 u_int16_t op_msk _U_
, int indent
)
1389 char *ib
= indent_pr(indent
, 0);
1391 const struct forces_ilv
*ilv
= (struct forces_ilv
*)pptr
;
1395 * redirect_print() has ensured that len (what remains in the
1398 dlen
= len
- TLV_HDRL
;
1400 printf("\n%s METADATA length %d \n", ib
, rlen
);
1403 invilv
= ilv_valid(ilv
, rlen
);
1409 * At this point, ilv_valid() has ensured that the ILV
1410 * length is large enough but not too large (it doesn't
1411 * go past the end of the containing TLV).
1413 print_metailv((u_char
*) ilv
, rlen
, 0, indent
+ 1);
1414 ilv
= GO_NXT_ILV(ilv
, rlen
);
1420 fputs("[|forces]", stdout
);
1426 print_reddata(register const u_char
* pptr
, register u_int len
,
1427 u_int16_t op_msk _U_
, int indent _U_
)
1430 char *ib
= indent_pr(indent
, 0);
1433 dlen
= len
- TLV_HDRL
;
1435 printf("\n%s Redirect Data length %d \n", ib
, rlen
);
1439 hex_print_with_offset("\n\t\t", pptr
, rlen
, 0);
1447 redirect_print(register const u_char
* pptr
, register u_int len
,
1448 u_int16_t op_msk _U_
, int indent
)
1450 const struct forces_tlv
*tlv
= (struct forces_tlv
*)pptr
;
1456 * forces_type_print() has ensured that len (the TLV length)
1459 dlen
= len
- TLV_HDRL
;
1460 if (dlen
<= RD_MIN
) {
1461 printf("\n\t\ttruncated Redirect TLV: %d bytes missing! ",
1470 invtlv
= tlv_valid(tlv
, rlen
);
1472 printf("Bad Redirect data\n");
1477 * At this point, tlv_valid() has ensured that the TLV
1478 * length is large enough but not too large (it doesn't
1479 * go past the end of the containing TLV).
1481 if (EXTRACT_16BITS(&tlv
->type
) == F_TLV_METD
) {
1482 print_metatlv((u_char
*) TLV_DATA(tlv
),
1483 EXTRACT_16BITS(&tlv
->length
), 0, indent
);
1484 } else if ((EXTRACT_16BITS(&tlv
->type
) == F_TLV_REDD
)) {
1485 print_reddata((u_char
*) TLV_DATA(tlv
),
1486 EXTRACT_16BITS(&tlv
->length
), 0, indent
);
1488 printf("Unknown REDIRECT TLV 0x%x len %d\n",
1489 EXTRACT_16BITS(&tlv
->type
),
1490 EXTRACT_16BITS(&tlv
->length
));
1493 tlv
= GO_NXT_TLV(tlv
, rlen
);
1498 ("\n\t\tMessy Redirect TLV header, type (0x%x)\n\t\texcess of %d Bytes ",
1499 EXTRACT_16BITS(&tlv
->type
),
1500 rlen
- EXTRACT_16BITS(&tlv
->length
));
1507 fputs("[|forces]", stdout
);
1515 lfbselect_print(register const u_char
* pptr
, register u_int len
,
1516 u_int16_t op_msk
, int indent
)
1518 const struct forces_lfbsh
*lfbs
;
1519 const struct forces_tlv
*otlv
;
1520 char *ib
= indent_pr(indent
, 0);
1526 * forces_type_print() has ensured that len (the TLV length)
1529 dlen
= len
- TLV_HDRL
;
1530 if (dlen
<= OP_MIN
) { /* id, instance, oper tlv header .. */
1531 printf("\n\t\ttruncated lfb selector: %d bytes missing! ",
1537 * At this point, we know that dlen > OP_MIN; OP_OFF < OP_MIN, so
1538 * we also know that it's > OP_OFF.
1540 rlen
= dlen
- OP_OFF
;
1542 lfbs
= (const struct forces_lfbsh
*)pptr
;
1545 printf("\n%s%s(Classid %x) instance %x\n",
1546 ib
, tok2str(ForCES_LFBs
, NULL
, EXTRACT_32BITS(&lfbs
->class)),
1547 EXTRACT_32BITS(&lfbs
->class),
1548 EXTRACT_32BITS(&lfbs
->instance
));
1551 otlv
= (struct forces_tlv
*)(lfbs
+ 1);
1556 invtlv
= tlv_valid(otlv
, rlen
);
1561 * At this point, tlv_valid() has ensured that the TLV
1562 * length is large enough but not too large (it doesn't
1563 * go past the end of the containing TLV).
1565 if (op_valid(EXTRACT_16BITS(&otlv
->type
), op_msk
)) {
1566 otlv_print(otlv
, 0, indent
);
1571 ("\t\tINValid oper-TLV type 0x%x length %d for this ForCES message\n",
1572 EXTRACT_16BITS(&otlv
->type
), EXTRACT_16BITS(&otlv
->length
));
1573 invoptlv_print((u_char
*)otlv
, rlen
, 0, indent
);
1575 otlv
= GO_NXT_TLV(otlv
, rlen
);
1580 ("\n\t\tMessy oper TLV header, type (0x%x)\n\t\texcess of %d Bytes ",
1581 EXTRACT_16BITS(&otlv
->type
), rlen
- EXTRACT_16BITS(&otlv
->length
));
1588 fputs("[|forces]", stdout
);
1593 forces_type_print(register const u_char
* pptr
, const struct forcesh
*fhdr _U_
,
1594 register u_int mlen
, const struct tom_h
*tops
)
1596 const struct forces_tlv
*tltlv
;
1603 * forces_print() has already checked that mlen >= ForCES_HDRL
1604 * by calling ForCES_HLN_VALID().
1606 rlen
= mlen
- ForCES_HDRL
;
1608 if (rlen
> TLV_HLN
) {
1609 if (tops
->flags
& ZERO_TTLV
) {
1610 printf("<0x%x>Illegal Top level TLV!\n", tops
->flags
);
1614 if (tops
->flags
& ZERO_MORE_TTLV
)
1616 if (tops
->flags
& ONE_MORE_TTLV
) {
1617 printf("\tTop level TLV Data missing!\n");
1622 if (tops
->flags
& ZERO_TTLV
) {
1626 ttlv
= tops
->flags
>> 4;
1627 tltlv
= GET_TOP_TLV(pptr
);
1629 /*XXX: 15 top level tlvs will probably be fine
1630 You are nuts if you send more ;-> */
1633 invtlv
= tlv_valid(tltlv
, rlen
);
1638 * At this point, tlv_valid() has ensured that the TLV
1639 * length is large enough but not too large (it doesn't
1640 * go past the end of the packet).
1642 if (!ttlv_valid(EXTRACT_16BITS(&tltlv
->type
))) {
1643 printf("\n\tInvalid ForCES Top TLV type=0x%x",
1644 EXTRACT_16BITS(&tltlv
->type
));
1649 printf("\t%s, length %d (data length %d Bytes)",
1650 tok2str(ForCES_TLV
, NULL
, EXTRACT_16BITS(&tltlv
->type
)),
1651 EXTRACT_16BITS(&tltlv
->length
),
1652 EXTRACT_16BITS(&tltlv
->length
) - TLV_HDRL
);
1654 rc
= tops
->print((u_char
*) TLV_DATA(tltlv
),
1655 EXTRACT_16BITS(&tltlv
->length
), tops
->op_msk
, 9);
1659 tltlv
= GO_NXT_TLV(tltlv
, rlen
);
1665 * XXX - if ttlv != 0, does that mean that the packet was too
1666 * short, and didn't have *enough* TLVs in it?
1669 printf("\tMess TopTLV header: min %u, total %d advertised %d ",
1670 TLV_HDRL
, rlen
, EXTRACT_16BITS(&tltlv
->length
));
1677 fputs("[|forces]", stdout
);
1682 forces_print(register const u_char
* pptr
, register u_int len
)
1684 const struct forcesh
*fhdr
;
1687 const struct tom_h
*tops
;
1690 fhdr
= (const struct forcesh
*)pptr
;
1692 if (!tom_valid(fhdr
->fm_tom
)) {
1693 printf("Invalid ForCES message type %d\n", fhdr
->fm_tom
);
1697 mlen
= ForCES_BLN(fhdr
);
1699 tops
= get_forces_tom(fhdr
->fm_tom
);
1700 if (tops
->v
== TOM_RSVD
) {
1701 printf("\n\tUnknown ForCES message type=0x%x", fhdr
->fm_tom
);
1705 printf("\n\tForCES %s ", tops
->s
);
1706 if (!ForCES_HLN_VALID(mlen
, len
)) {
1708 ("Illegal ForCES pkt len - min %u, total recvd %d, advertised %d ",
1709 ForCES_HDRL
, len
, ForCES_BLN(fhdr
));
1713 TCHECK2(*(pptr
+ 20), 4);
1714 flg_raw
= EXTRACT_32BITS(pptr
+ 20);
1716 printf("\n\tForCES Version %d len %uB flags 0x%08x ",
1717 ForCES_V(fhdr
), mlen
, flg_raw
);
1718 printf("\n\tSrcID 0x%x(%s) DstID 0x%x(%s) Correlator 0x%" PRIx64
,
1719 ForCES_SID(fhdr
), ForCES_node(ForCES_SID(fhdr
)),
1720 ForCES_DID(fhdr
), ForCES_node(ForCES_DID(fhdr
)),
1721 EXTRACT_64BITS(fhdr
->fm_cor
));
1726 ("\n\tForCES flags:\n\t %s(0x%x), prio=%d, %s(0x%x),\n\t %s(0x%x), %s(0x%x)\n",
1727 ForCES_ACKp(ForCES_ACK(fhdr
)), ForCES_ACK(fhdr
),
1729 ForCES_EMp(ForCES_EM(fhdr
)), ForCES_EM(fhdr
),
1730 ForCES_ATp(ForCES_AT(fhdr
)), ForCES_AT(fhdr
),
1731 ForCES_TPp(ForCES_TP(fhdr
)), ForCES_TP(fhdr
));
1733 ("\t Extra flags: rsv(b5-7) 0x%x rsv(b13-31) 0x%x\n",
1734 ForCES_RS1(fhdr
), ForCES_RS2(fhdr
));
1736 rc
= forces_type_print(pptr
, fhdr
, mlen
, tops
);
1739 hex_print_with_offset("\n\t[", pptr
, len
, 0);
1745 printf("\n\t Raw ForCES message\n\t [");
1746 hex_print_with_offset("\n\t ", pptr
, len
, 0);
1753 fputs("[|forces]", stdout
);