Renamed bbmd to bvlc as the acronym was more accurate.
This commit is contained in:
@@ -38,10 +38,12 @@
|
|||||||
#include "bip.h"
|
#include "bip.h"
|
||||||
#include "net.h" /* custom per port */
|
#include "net.h" /* custom per port */
|
||||||
|
|
||||||
/* Handle the BACnet Broadcast Management Device,
|
/* Handle the BACnet Virtual Link Control (BVLC), which includes:
|
||||||
Broadcast Distribution Table, and Foreign Device Registration */
|
BACnet Broadcast Management Device,
|
||||||
|
Broadcast Distribution Table, and
|
||||||
|
Foreign Device Registration */
|
||||||
|
|
||||||
int bbmd_encode_bvlc_result(
|
int bvlc_encode_bvlc_result(
|
||||||
uint8_t *pdu,
|
uint8_t *pdu,
|
||||||
BACNET_BVLC_RESULT result_code)
|
BACNET_BVLC_RESULT result_code)
|
||||||
{
|
{
|
||||||
@@ -58,7 +60,7 @@ int bbmd_encode_bvlc_result(
|
|||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bbmd_encode_write_bdt_init(
|
int bvlc_encode_write_bdt_init(
|
||||||
uint8_t *pdu,
|
uint8_t *pdu,
|
||||||
unsigned entries)
|
unsigned entries)
|
||||||
{
|
{
|
||||||
@@ -77,7 +79,7 @@ int bbmd_encode_write_bdt_init(
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bbmd_encode_address(
|
int bvlc_encode_address(
|
||||||
uint8_t *pdu,
|
uint8_t *pdu,
|
||||||
struct in_addr *address, /* in host format */
|
struct in_addr *address, /* in host format */
|
||||||
uint16_t port)
|
uint16_t port)
|
||||||
@@ -93,7 +95,7 @@ int bbmd_encode_address(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* used for both read and write entries */
|
/* used for both read and write entries */
|
||||||
int bbmd_encode_address_entry(
|
int bvlc_encode_address_entry(
|
||||||
uint8_t *pdu,
|
uint8_t *pdu,
|
||||||
struct in_addr *address,
|
struct in_addr *address,
|
||||||
uint16_t port,
|
uint16_t port,
|
||||||
@@ -102,14 +104,14 @@ int bbmd_encode_address_entry(
|
|||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
if (pdu) {
|
if (pdu) {
|
||||||
len = bbmd_encode_address(pdu, address, port);
|
len = bvlc_encode_address(pdu, address, port);
|
||||||
len += encode_unsigned32(&pdu[len], mask->s_addr);
|
len += encode_unsigned32(&pdu[len], mask->s_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bbmd_encode_read_bdt(
|
int bvlc_encode_read_bdt(
|
||||||
uint8_t *pdu)
|
uint8_t *pdu)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
@@ -127,7 +129,7 @@ int bbmd_encode_read_bdt(
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bbmd_encode_read_bdt_ack_init(
|
int bvlc_encode_read_bdt_ack_init(
|
||||||
uint8_t *pdu,
|
uint8_t *pdu,
|
||||||
unsigned entries)
|
unsigned entries)
|
||||||
{
|
{
|
||||||
@@ -146,7 +148,7 @@ int bbmd_encode_read_bdt_ack_init(
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bbmd_encode_forwarded_npdu(
|
int bvlc_encode_forwarded_npdu(
|
||||||
uint8_t *pdu,
|
uint8_t *pdu,
|
||||||
BACNET_ADDRESS *src,
|
BACNET_ADDRESS *src,
|
||||||
uint8_t *npdu,
|
uint8_t *npdu,
|
||||||
@@ -176,7 +178,7 @@ int bbmd_encode_forwarded_npdu(
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bbmd_encode_register_foreign_device(
|
int bvlc_encode_register_foreign_device(
|
||||||
uint8_t *pdu,
|
uint8_t *pdu,
|
||||||
uint16_t time_to_live_seconds)
|
uint16_t time_to_live_seconds)
|
||||||
{
|
{
|
||||||
@@ -196,7 +198,7 @@ int bbmd_encode_register_foreign_device(
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bbmd_encode_read_fdt(
|
int bvlc_encode_read_fdt(
|
||||||
uint8_t *pdu)
|
uint8_t *pdu)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
@@ -214,7 +216,7 @@ int bbmd_encode_read_fdt(
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bbmd_encode_read_fdt_ack_init(
|
int bvlc_encode_read_fdt_ack_init(
|
||||||
uint8_t *pdu,
|
uint8_t *pdu,
|
||||||
unsigned entries)
|
unsigned entries)
|
||||||
{
|
{
|
||||||
@@ -233,7 +235,7 @@ int bbmd_encode_read_fdt_ack_init(
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bbmd_encode_delete_fdt_entry(
|
int bvlc_encode_delete_fdt_entry(
|
||||||
uint8_t *pdu,
|
uint8_t *pdu,
|
||||||
struct in_addr *address,
|
struct in_addr *address,
|
||||||
uint16_t port)
|
uint16_t port)
|
||||||
@@ -256,7 +258,7 @@ int bbmd_encode_delete_fdt_entry(
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bbmd_encode_distribute_broadcast_to_network(
|
int bvlc_encode_distribute_broadcast_to_network(
|
||||||
uint8_t *pdu,
|
uint8_t *pdu,
|
||||||
uint8_t *npdu,
|
uint8_t *npdu,
|
||||||
unsigned npdu_length)
|
unsigned npdu_length)
|
||||||
@@ -280,7 +282,7 @@ int bbmd_encode_distribute_broadcast_to_network(
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bbmd_encode_original_unicast_npdu(
|
int bvlc_encode_original_unicast_npdu(
|
||||||
uint8_t * pdu,
|
uint8_t * pdu,
|
||||||
uint8_t * npdu,
|
uint8_t * npdu,
|
||||||
unsigned npdu_length)
|
unsigned npdu_length)
|
||||||
@@ -304,7 +306,7 @@ int bbmd_encode_original_unicast_npdu(
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bbmd_encode_original_broadcast_npdu(
|
int bvlc_encode_original_broadcast_npdu(
|
||||||
uint8_t * pdu,
|
uint8_t * pdu,
|
||||||
uint8_t * npdu,
|
uint8_t * npdu,
|
||||||
unsigned npdu_length)
|
unsigned npdu_length)
|
||||||
@@ -328,7 +330,7 @@ int bbmd_encode_original_broadcast_npdu(
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bbmd_handler(uint8_t *buf, int len, struct sockaddr_in *sin)
|
void bvlc_handler(uint8_t *buf, int len, struct sockaddr_in *sin)
|
||||||
{
|
{
|
||||||
int function_type = 0;
|
int function_type = 0;
|
||||||
|
|
||||||
@@ -371,8 +373,9 @@ void bbmd_handler(uint8_t *buf, int len, struct sockaddr_in *sin)
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "ctest.h"
|
#include "ctest.h"
|
||||||
|
|
||||||
void testBBMD(Test * pTest)
|
void testBVLC(Test * pTest)
|
||||||
{
|
{
|
||||||
|
(void)pTest;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TEST_BBMD
|
#ifdef TEST_BBMD
|
||||||
@@ -381,9 +384,9 @@ int main(void)
|
|||||||
Test *pTest;
|
Test *pTest;
|
||||||
bool rc;
|
bool rc;
|
||||||
|
|
||||||
pTest = ct_create("BACnet Broadcast Management Device (BBMD)", NULL);
|
pTest = ct_create("BACnet Virtual Link Control", NULL);
|
||||||
/* individual tests */
|
/* individual tests */
|
||||||
rc = ct_addTestFunction(pTest, testBBMD);
|
rc = ct_addTestFunction(pTest, testBVLC);
|
||||||
assert(rc);
|
assert(rc);
|
||||||
|
|
||||||
/* configure output */
|
/* configure output */
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE CodeBlocks_project_file>
|
||||||
|
<CodeBlocks_project_file>
|
||||||
|
<FileVersion major="1" minor="1"/>
|
||||||
|
<Project>
|
||||||
|
<Option title="BVLC Unit Test"/>
|
||||||
|
<Option makefile="Makefile"/>
|
||||||
|
<Option makefile_is_custom="0"/>
|
||||||
|
<Option compiler="2"/>
|
||||||
|
<Build>
|
||||||
|
<Target title="default">
|
||||||
|
<Option output="C:\code\bacnet-stack\bbmd.exe"/>
|
||||||
|
<Option working_dir="."/>
|
||||||
|
<Option object_output=".objs"/>
|
||||||
|
<Option deps_output=".deps"/>
|
||||||
|
<Option type="1"/>
|
||||||
|
<Option compiler="2"/>
|
||||||
|
<Option projectResourceIncludeDirsRelation="1"/>
|
||||||
|
</Target>
|
||||||
|
</Build>
|
||||||
|
<Compiler>
|
||||||
|
<Add option="-w-aus"/>
|
||||||
|
<Add option="-w-sig"/>
|
||||||
|
<Add option="-DTEST;TEST_BBMD;BACDL_BIP=1;TSM_ENABLED=1"/>
|
||||||
|
<Add directory="."/>
|
||||||
|
<Add directory="demo\handler"/>
|
||||||
|
<Add directory="demo\object"/>
|
||||||
|
<Add directory="ports\win32"/>
|
||||||
|
<Add directory="test"/>
|
||||||
|
</Compiler>
|
||||||
|
<Linker>
|
||||||
|
<Add library="..\..\BCC55\Lib\import32.lib"/>
|
||||||
|
<Add library="..\..\BCC55\Lib\cw32mt.lib"/>
|
||||||
|
</Linker>
|
||||||
|
<Unit filename="bacdcode.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="bacdcode.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="bacdef.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="bacenum.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="bacstr.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="bacstr.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="bigend.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="bigend.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="bvlc.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="bvlc.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="test\ctest.c">
|
||||||
|
<Option compilerVar="CC"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="test\ctest.h">
|
||||||
|
<Option compilerVar=""/>
|
||||||
|
<Option compile="0"/>
|
||||||
|
<Option link="0"/>
|
||||||
|
<Option target="default"/>
|
||||||
|
</Unit>
|
||||||
|
</Project>
|
||||||
|
</CodeBlocks_project_file>
|
||||||
@@ -31,8 +31,8 @@
|
|||||||
License.
|
License.
|
||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
####COPYRIGHTEND####*/
|
####COPYRIGHTEND####*/
|
||||||
#ifndef BBMD_H
|
#ifndef BVLC_H
|
||||||
#define BBMD_H
|
#define BVLC_H
|
||||||
|
|
||||||
#include <stdint.h> /* for standard integer types uint8_t etc. */
|
#include <stdint.h> /* for standard integer types uint8_t etc. */
|
||||||
#include <stdbool.h> /* for the standard bool type. */
|
#include <stdbool.h> /* for the standard bool type. */
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
void bbmd_handler(uint8_t *buf, int len, struct sockaddr_in *sin);
|
void bvlc_handler(uint8_t *buf, int len, struct sockaddr_in *sin);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user