Re: [Bacnet-developers] [Update] Activating BVLC code
Brought to you by:
skarg
|
From: <tom...@sw...> - 2008-01-14 11:49:03
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sun, Jan 13, 2008 at 12:12:20PM +0000, tom...@sw... wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello,
>
> call me crazy, but I'm giving a try at the (as far as I can see not yet
> fully functional) BVLC code [...]
Whois works now with "forwarded broadcast" answers. Wohoo! :-)
The only issue I found was in bvlc.c. The BVLC header is a bit longer
for this kind of messages (10 bytes instead of four, to accomodate the
original MAC address). Note that I haven't a version of Annex J, so I'm
working off what Wireshark tells me.
The tentative fix is more or less like so (but bear in mind that I might
just partially know what I'm doing):
=========================================================
- --- a/src/bvlc.c
+++ b/src/bvlc.c
@@ -936,12 +936,27 @@ uint16_t bvlc_receive(
/* if this was received via Broadcast, don't broadcast it
* */
/* FIXME: how do I know if I received a unicast or broadcast? */
+ npdu_len -= 6; /* FIXME very ugly */
if (!bvlc_broadcast_address_same(&sin)) {
dest.sin_addr.s_addr = htonl(bip_get_broadcast_addr());
dest.sin_port == htons(bip_get_port());
bvlc_send_mpdu(&dest, &npdu[4], npdu_len);
}
bvlc_fdt_forward_npdu(&sin, &npdu[4], npdu_len);
+ /* FIXME we might want to do something with tne MAC provided
+ in the BVLC header
+ */
+ if (npdu_len < max_npdu) {
+ /* shift the buffer to return a valid PDU */
+ for (i = 0; i < npdu_len; i++) {
+ npdu[i] = npdu[i + 10];
+ }
+ } else {
+ /* ignore packets that are too large */
+ /* clients should check my max-apdu first */
+ npdu_len = 0;
+ }
+
break;
case BVLC_REGISTER_FOREIGN_DEVICE:
/* Upon receipt of a BVLL Register-Foreign-Device message, a BBMD
=========================================================
All in all I'm impressed by your code quality. For a part of the code which
is not really supposed to be ready, it is really near to working status.
Thanks and regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFHi0rSBcgs9XrR2kYRAhiBAJ9KmliY4XUGogcQa6LkKhMN/4j30ACZAWiT
1NysTSN//WWhuWjI+ZKjw7g=
=kyL0
-----END PGP SIGNATURE-----
|