The Secret Journey

Entries categorized as ‘Quagga’

what a “struct ospf_packet” for

May 3, 2007 · Leave a Comment

struct ospf_packet
{
struct ospf_packet *next;

/* Pointer to data stream. */
struct stream *s;

/* IP destination address. */
struct in_addr dst;

/* OSPF packet length. */
u_int16_t length;
};

I was not so sure why I would need something like the struct above ? Now I understand that it’s useful to modify anything inside the s. And I would need it for the checksum

Categories: Programming · Quagga

Integer Constant with U ?

May 2, 2007 · 2 Comments

#define OSPF_HEADER_SIZE 24U

Why not defining that with:

#define OSPF_HEADER_SIZE 24

What would make it difference ? Hmmm…

Update:

It will give a different result when we compare it with any number < 0,  the comparison number will be converted to unsigned Integer. Thank you very much to drj11 for the answer.

—————– test.c ———————————–

#define TESTU 24U
#define TEST 24

void main()
{
if (-1<TESTU) printf(“-1< TESTU ! /n”);
if (-1<TEST) printf(“-1< TEST ! /n”);
}

————- EOF ————————————-

Categories: Programming · Quagga