[Xorp-hackers] [PIM] Setting a bit in the Encoded source address
Pavlin Radoslavov
pavlin at icir.org
Tue Mar 6 12:05:13 PST 2007
chintamani wandhre <chintamanisw at gmail.com> wrote:
> hello,
> We have to set the bidirectional bit in the ENCODED GROUP ADDRESS
>
>
> 0 1 2 3
> 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> | Addr Family | Encoding Type |B| Reserved |Z| Mask Len |
> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> | Group multicast Address
> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+...
>
> By using following function we can get octet but how can we set the single
> bit ( B )? :)
>
> i could not get the flow in the following code :
>
> #define GET_OCTET(val, cp, rcvlen) \
> do { \
> if ((size_t)(rcvlen) < (size_t)1) \
> goto rcvlen_error; \
> (rcvlen)--; \
> ((val) = *(cp)++); \
> } while (0)
>
> thanking you in anticipation
You could use the PUT_OCTET() macro.
I believe the remaining 7 bits in the Reserved field are suppose to
be 0. Hence you need to use PUT_OCTET() to set both Reserved and Z
at the same time (because they belong to the same octet).
Regards,
Pavlin
More information about the Xorp-hackers
mailing list