Commit Graph

23 Commits

Author SHA1 Message Date
Guy Harris
c951c5012e Fix ForCES warnings, clean up a bit.
Move forces.h into print-forces.c, make a bunch of routines static, and
fix some warnings.
2013-07-23 13:12:54 -07:00
Jamal Hadi Salim
571bf538d8 add support for appending table rows 2013-07-16 09:38:25 -04:00
Jamal Hadi Salim
ec92c2539f Add support for getting table ranges Fixup get by key formatting while at it 2013-07-16 09:38:25 -04:00
Jamal Hadi Salim
93e641bdc0 Print redirect data and metadata details only when verbosity is at least at level 3 2013-07-16 09:38:25 -04:00
Jamal Hadi Salim
0ee9e1a26b Print redirect packetdata correctly 2013-07-16 09:38:25 -04:00
Jamal Hadi Salim
871b4b4d7c Print redirect Metadata correctly 2013-07-16 09:38:25 -04:00
Guy Harris
5bc4bf28c9 Check the return value of some print routines.
Some routines return -1 on error; bail and return -1 if they do.
2012-06-08 19:14:06 -07:00
Guy Harris
f6d40d5bb8 Fix printing of 64-bit quantities.
Do *NOT* assume that "%l[doxu]x" - or "%ll[doxu]" - is the way to print
a 64-bit quantity; on UN*X, it might be a "long" or a "long long",
depending on whether you're on a 32-bit or 64-bit platform and, on
Windows with MSVC++, it's not a long (even in 64-bit mode) and doesn't
use "%ll[doxu]", either.  Instead, use PRI[doxu]64; that's what C99
defines, and what we define ourselves if the C environment doesn't
define it.
2012-06-07 22:12:28 -07:00
Michael Richardson
e3581ca17e fixes from Jamal Hadi Salim <hadi@mojatatu.com> for forces: SPARSE data (per RFC 5810) 2012-03-29 16:08:35 +02:00
Jamal Hadi Salim
f65274c570 Use proper type (16bit) when extracting path id count
Signed-off-by: Jamal Hadi Salim <hadi@mojatatu.com>
Signed-off-by: Michael Richardson <mcr@sandelman.ca>
2011-01-25 19:59:44 -05:00
Jamal Hadi Salim
a9de1ae94e Fix mixing recursive and flat Path Data
+--PD
 .  +--PD
 .  |
 .  |
 .  +--PD
 .
 .
 +--PD
 |
 |
 +--PD

or
 +--PD
 .  +--PD
 .     +
 .     |
 .     +--PD
 .         +
 .         |
 .         +-- PD
 .         +
 .         |
 .         +-- PD
 +--PD
 |
 |
 +--PD

etc

Signed-off-by: Jamal Hadi Salim <hadi@mojatatu.com>
Signed-off-by: Michael Richardson <mcr@sandelman.ca>
2011-01-25 19:57:55 -05:00
Jamal Hadi Salim
375352c72b Fix indent space when we have padded data
See if you can spot the difference between

    Pathdata: Flags 0x0 ID count 1
      ID#01: 3
     FULLDATA TLV (Length 10 DataLen 6 pad 2 Bytes)
       [
       0x0000:  0002 0406 080a 0000
       ]

and:
    Pathdata: Flags 0x0 ID count 1
      ID#01: 3
      FULLDATA TLV (Length 10 DataLen 6 pad 2 Bytes)
       [
       0x0000:  0002 0406 080a 0000
       ]

Signed-off-by: Jamal Hadi Salim <hadi@mojatatu.com>
Signed-off-by: Michael Richardson <mcr@sandelman.ca>
2011-01-25 19:56:52 -05:00
Guy Harris
72de6e8bc3 Use rlen rather than tll as the name of "remaining length" variables. 2010-02-07 18:02:41 -08:00
Guy Harris
606a29c55c Check the containing item length in some loops.
In some loops, don't loop just until we get an error, stop when we run
out of data to parse.

Also, add some comments to indicate what we know about lengths at
various points, before we do something with the length that happens to
assume what we know.  Add some checks that this auditing found
necessary.
2010-02-07 17:47:31 -08:00
Guy Harris
7906cae611 Use #defines rather than sizeof.
Use ForCES_HDRL, TLV_HDRL, and ILV_HDRL instead of various sizeof's, to
make it clearer what certain tests ensure are true (as, in other cases,
the #defines are subtracted from values that should be, at that point,
ensured not to be less than the #define in question).
2010-02-07 16:05:46 -08:00
Guy Harris
20194339f9 Constify a bunch of stuff. 2010-01-26 20:14:23 -08:00
Guy Harris
44c1734ba8 Put PRIu64 on the same line as the rest of the format string. 2010-01-26 18:50:53 -08:00
Guy Harris
6ee5663a02 Add TCHECKs, make length variables 32 bits.
Add TCHECK/TCHECK2 calls to make sure we are within the packet boundary
before fetching data.  Make some length variables that could in theory
have values that don't fit in 16 bits 32 bits long.

Get rid of blanks before newlines.
2010-01-26 18:43:22 -08:00
Guy Harris
67c76d583f Use EXTRACT_16BITS() and EXTRACT_32BITS() to fetch integral values.
Use EXTRACT_16BITS() and EXTRACT_32BITS() to fetch 16-bit and 32-bit
big-endian quantities from the packet, as there's no guarantee that a
given 16-bit quantity will be aligned on a 2-byte boundary or that a
given 32-bit quantity will be aligned on a 4-byte boundary, nor is there
a guarantee that unaligned accesses will succeed (they might trap, or
they might not fetch an unaligned quantity).
2010-01-26 17:56:36 -08:00
Guy Harris
d033ee2f3e Squelch some int-vs-long errors. 2010-01-10 18:36:45 -08:00
Guy Harris
64d92662c3 Don't use bitfields in on-the-wire structures.
C doesn't guarantee that bit fields will be in any particular order.
2010-01-10 17:56:49 -08:00
Guy Harris
832716b73d Fix a bunch of warnings in the ForCES printer.
Get rid of C++/C99-style comments while we're at it; some C compilers
reject them.
2010-01-10 14:16:41 -08:00
Michael Richardson
d0e01819c0 IETF FORCES protocol printer, from Jamal Hadi Salim <hadi at cyberus.ca. 2010-01-10 14:49:46 -05:00