From c62d283ec45937dc571eca99d324444b4b16be1a Mon Sep 17 00:00:00 2001 From: skarg Date: Wed, 16 Mar 2005 19:47:16 +0000 Subject: [PATCH] compiles! --- bacnet-stack/ports/linux/ethernet.c | 25 +++++++------------- bacnet-stack/ports/linux/main.c | 36 ++++++++++++++++++----------- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/bacnet-stack/ports/linux/ethernet.c b/bacnet-stack/ports/linux/ethernet.c index 6c0c4732..7e27904c 100644 --- a/bacnet-stack/ports/linux/ethernet.c +++ b/bacnet-stack/ports/linux/ethernet.c @@ -37,22 +37,16 @@ #include /* Error number and related */ #include // for standard integer types uint8_t etc. #include // for the standard bool type. -//#include /* System time values */ -//#include /* System data types */ -//#include /* File statistics */ -//#include /* Command-line options */ -//#include /* FD-based file-control */ -//#include /* string hanfling functions */ -//#include /* signal handling functions */ -//#include /* time functions */ -//#include +#include /* System data types */ +#include /* Command-line options */ +#include /* string hanfling functions */ #define ENUMS #include -//#include -//#include -//#include /* for the glibc version number */ +#include +#include +#include /* for the glibc version number */ #if __GLIBC__ >= 2 && __GLIBC_MINOR >= 1 #include #include /* the L2 protocols */ @@ -61,11 +55,8 @@ #include #include /* The L2 protocols */ #endif -//#include -//#include -//#include -//#include -//#include +#include +#include #include "bacdef.h" #include "ethernet.h" diff --git a/bacnet-stack/ports/linux/main.c b/bacnet-stack/ports/linux/main.c index f56189d8..0b36df92 100644 --- a/bacnet-stack/ports/linux/main.c +++ b/bacnet-stack/ports/linux/main.c @@ -35,6 +35,7 @@ #include #include +#include #include "bacdef.h" #include "npdu.h" #include "iam.h" @@ -55,10 +56,11 @@ bool I_Am_Request = true; // services are supported and what services are rejected void Process_APDU( BACNET_ADDRESS *src, // source address + bool data_expecting_reply, uint8_t *apdu, // APDU data - uint16_t pdu_len, // length of the PDU - uint8_t invoke_id) // for confirmed messages + uint16_t pdu_len) // for confirmed messages { + uint8_t invoke_id = 0; } @@ -67,19 +69,27 @@ void Process_PDU( uint8_t *pdu, // PDU data uint16_t pdu_len) // length PDU { - uint8_t invoke_id = 0; int apdu_offset = 0; + BACNET_ADDRESS dest = {0}; + BACNET_NPDU_DATA npdu_data = {0}; apdu_offset = npdu_decode( - &src, // source address - get the SADR/SNET if in there - &pdu[0], - pdu_len - &invoke_id); - Process_APDU( - &src, - &pdu[apdu_offset], - pdu_len - apdu_offset, - invoke_id); + &pdu[0], // data to decode + &dest, // destination address - get the DNET/DLEN/DADR if in there + src, // source address - get the SNET/SLEN/SADR if in there + &npdu_data); // amount of data to decode + if (npdu_data.network_layer_message) + { + fprintf(stderr,"main: network layer message received!"); + } + else + { + Process_APDU( + src, + npdu_data.data_expecting_reply, + &pdu[apdu_offset], + pdu_len - apdu_offset); + } return; } @@ -117,7 +127,7 @@ void Send_IAm(void) pdu_len); // number of bytes of data } -int main(void) +int main(int argc, char *argv[]) { BACNET_ADDRESS src = {0}; // address where message came from uint16_t pdu_len = 0;