Added some fixes to router demo
This commit is contained in:
@@ -90,6 +90,7 @@ error:
|
||||
$(MAKE) -B -C demo error
|
||||
|
||||
router:
|
||||
$(MAKE) -s -C lib all
|
||||
$(MAKE) -s -C demo router
|
||||
|
||||
# Add "ports" to the build, if desired
|
||||
|
||||
@@ -33,6 +33,9 @@ SRCS = main.c \
|
||||
$(BACNET_OBJECT)/mso.c \
|
||||
$(BACNET_OBJECT)/msv.c \
|
||||
$(BACNET_OBJECT)/nc.c \
|
||||
$(BACNET_OBJECT)/osv.c \
|
||||
$(BACNET_OBJECT)/piv.c \
|
||||
$(BACNET_OBJECT)/schedule.c \
|
||||
$(BACNET_OBJECT)/trendlog.c \
|
||||
$(BACNET_OBJECT)/bacfile.c
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ bool send_to_msgbox(
|
||||
|
||||
int err;
|
||||
|
||||
err = msgsnd(dest, msg, sizeof(BACMSG), 0);
|
||||
err = msgsnd(dest, msg, sizeof(BACMSG)-sizeof(MSGTYPE), 0);
|
||||
if (err) {
|
||||
return false;
|
||||
}
|
||||
@@ -69,7 +69,7 @@ BACMSG *recv_from_msgbox(
|
||||
|
||||
int recv_bytes;
|
||||
|
||||
recv_bytes = msgrcv(src, msg, sizeof(BACMSG), 0, IPC_NOWAIT);
|
||||
recv_bytes = msgrcv(src, msg, sizeof(BACMSG)-sizeof(MSGTYPE), 0, IPC_NOWAIT);
|
||||
if (recv_bytes > 0) {
|
||||
return msg;
|
||||
} else {
|
||||
|
||||
@@ -44,7 +44,7 @@ extern pthread_mutex_t msg_lock;
|
||||
typedef int MSGBOX_ID;
|
||||
|
||||
typedef enum {
|
||||
DATA,
|
||||
DATA = 1,
|
||||
SERVICE
|
||||
} MSGTYPE;
|
||||
|
||||
@@ -55,8 +55,8 @@ typedef enum {
|
||||
} MSGSUBTYPE;
|
||||
|
||||
typedef struct _message {
|
||||
MSGBOX_ID origin;
|
||||
MSGTYPE type;
|
||||
MSGBOX_ID origin;
|
||||
MSGSUBTYPE subtype;
|
||||
void *data;
|
||||
/* add timestamp */
|
||||
|
||||
@@ -170,6 +170,23 @@ uint16_t process_network_message(
|
||||
case NETWORK_MESSAGE_DISCONNECT_CONNECTION_TO_NETWORK:
|
||||
/* hell if I know what to do with these messages */
|
||||
break;
|
||||
case NETWORK_MESSAGE_CHALLENGE_REQUEST:
|
||||
case NETWORK_MESSAGE_SECURITY_PAYLOAD:
|
||||
case NETWORK_MESSAGE_SECURITY_RESPONSE:
|
||||
case NETWORK_MESSAGE_REQUEST_KEY_UPDATE:
|
||||
case NETWORK_MESSAGE_UPDATE_KEY_SET:
|
||||
case NETWORK_MESSAGE_UPDATE_DISTRIBUTION_KEY:
|
||||
case NETWORK_MESSAGE_REQUEST_MASTER_KEY:
|
||||
case NETWORK_MESSAGE_SET_MASTER_KEY:
|
||||
case NETWORK_MESSAGE_NETWORK_NUMBER_IS:
|
||||
/* security messages */
|
||||
break;
|
||||
case NETWORK_MESSAGE_WHAT_IS_NETWORK_NUMBER:
|
||||
buff_len =
|
||||
create_network_message(NETWORK_MESSAGE_NETWORK_NUMBER_IS,
|
||||
data, buff, &buff);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
PRINT(ERROR, "Error: Message unsupported\n");
|
||||
@@ -280,6 +297,21 @@ uint16_t create_network_message(
|
||||
case NETWORK_MESSAGE_DISCONNECT_CONNECTION_TO_NETWORK:
|
||||
/* hell if I know what to do with these messages */
|
||||
break;
|
||||
case NETWORK_MESSAGE_CHALLENGE_REQUEST:
|
||||
case NETWORK_MESSAGE_SECURITY_PAYLOAD:
|
||||
case NETWORK_MESSAGE_SECURITY_RESPONSE:
|
||||
case NETWORK_MESSAGE_REQUEST_KEY_UPDATE:
|
||||
case NETWORK_MESSAGE_UPDATE_KEY_SET:
|
||||
case NETWORK_MESSAGE_UPDATE_DISTRIBUTION_KEY:
|
||||
case NETWORK_MESSAGE_REQUEST_MASTER_KEY:
|
||||
case NETWORK_MESSAGE_SET_MASTER_KEY:
|
||||
/* security messages */
|
||||
break;
|
||||
case NETWORK_MESSAGE_NETWORK_NUMBER_IS:
|
||||
/* fixme: needs message constructed */
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return buff_len;
|
||||
|
||||
@@ -34,8 +34,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
3. Build
|
||||
-----------------------
|
||||
|
||||
1. Download, build and install libconfig C/C++ Configuration File Library from http://www.hyperrealm.com/libconfig
|
||||
2. Set variable "BACNET_PORT" in library root diredory Makefile to linux
|
||||
1. Download, build and install libconfig C/C++ Configuration File Library
|
||||
from http://www.hyperrealm.com/libconfig or use APT to install
|
||||
sudo apt-get install libconfig-dev
|
||||
2. Set variable "BACNET_PORT" in library root directory Makefile to linux
|
||||
3. Run "make clean all" from library root directory
|
||||
|
||||
-----------------------
|
||||
|
||||
@@ -160,7 +160,7 @@ int dlmstp_send_pdu(
|
||||
}
|
||||
pkt->length = pdu_len;
|
||||
pkt->destination_mac = dest->mac[0];
|
||||
if (Ringbuf_Data_Put(&PDU_Queue, (uint8_t *)pkt)) {
|
||||
if (Ringbuf_Data_Put(&poSharedData->PDU_Queue, (uint8_t *)pkt)) {
|
||||
bytes_sent = pdu_len;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user