corrected code to make it work

This commit is contained in:
skarg
2005-03-23 16:53:10 +00:00
parent a69905c8a3
commit e68f8008d5
2 changed files with 6 additions and 15 deletions
+3 -12
View File
@@ -203,16 +203,7 @@ int ethernet_send(
{ {
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
{ {
mtu[i] = dest->mac[i]; mtu[mtu_len] = dest->mac[i];
mtu_len++;
}
}
// Global Broadcast
else if (dest->mac_len == 0)
{
for (i = 0; i < 6; i++)
{
mtu[i] = Ethernet_Broadcast[i];
mtu_len++; mtu_len++;
} }
} }
@@ -227,7 +218,7 @@ int ethernet_send(
{ {
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
{ {
mtu[i] = src->mac[i]; mtu[mtu_len] = src->mac[i];
mtu_len++; mtu_len++;
} }
} }
@@ -377,7 +368,7 @@ void ethernet_set_broadcast_address(
{ {
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
{ {
dest->mac[i] = 0xFF; dest->mac[i] = Ethernet_Broadcast[i];
} }
dest->mac_len = 6; dest->mac_len = 6;
dest->net = BACNET_BROADCAST_NETWORK; dest->net = BACNET_BROADCAST_NETWORK;
+3 -3
View File
@@ -35,8 +35,7 @@ void Send_IAm(void)
BACNET_ADDRESS src; BACNET_ADDRESS src;
// I-Am is a global broadcast // I-Am is a global broadcast
dest.mac_len = 0; ethernet_set_broadcast_address(&dest);
ethernet_get_my_address(&src); ethernet_get_my_address(&src);
// encode the NPDU portion of the packet // encode the NPDU portion of the packet
@@ -59,6 +58,7 @@ void Send_IAm(void)
&dest, // destination address &dest, // destination address
&Tx_Buf[0], &Tx_Buf[0],
pdu_len); // number of bytes of data pdu_len); // number of bytes of data
fprintf(stderr,"Sent I-Am Request!\n");
} }
void WhoIsHandler( void WhoIsHandler(
@@ -70,7 +70,7 @@ void WhoIsHandler(
int32_t low_limit = 0; int32_t low_limit = 0;
int32_t high_limit = 0; int32_t high_limit = 0;
fprintf(stderr,"Received Who-Is Request!\r"); fprintf(stderr,"Received Who-Is Request!\n");
len = whois_decode_service_request( len = whois_decode_service_request(
service_request, service_request,
service_len, service_len,