Files
bacnet_stack/src/bacnet/hostnport.h
T
Steve Karg b9a29d8093 add defines for each supported BACAPP_TYPES_EXTRA (#543)
* add defines for each supported BACAPP_TYPES_EXTRA

---------

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2023-12-01 12:23:44 -06:00

79 lines
2.0 KiB
C

/**
* @file
* @brief API for BACnetHostNPort complex data type encode and decode
* @author Steve Karg <skarg@users.sourceforge.net>
* @date May 2022
* @section LICENSE
*
* Copyright (C) 2022 Steve Karg <skarg@users.sourceforge.net>
*
* SPDX-License-Identifier: MIT
*/
#ifndef BACNET_HOST_N_PORT_H
#define BACNET_HOST_N_PORT_H
#include <stdint.h>
#include <stdbool.h>
#include "bacnet/bacnet_stack_exports.h"
#include "bacnet/bacenum.h"
#include "bacnet/bacstr.h"
#include "bacnet/datalink/bvlc.h"
/**
* BACnetHostNPort ::= SEQUENCE {
* host [0] BACnetHostAddress,
* BACnetHostAddress ::= CHOICE {
* none [0] NULL,
* ip-address [1] OCTET STRING,
* name [2] CharacterString
* }
* port [1] Unsigned16
* }
*/
typedef struct BACnetHostNPort {
bool host_ip_address:1;
bool host_name:1;
union BACnetHostAddress {
/* none = host_ip_address AND host_name are FALSE */
BACNET_OCTET_STRING ip_address;
BACNET_CHARACTER_STRING name;
} host;
uint16_t port;
} BACNET_HOST_N_PORT;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
BACNET_STACK_EXPORT
int host_n_port_encode(
uint8_t * apdu,
BACNET_HOST_N_PORT *address);
BACNET_STACK_EXPORT
int host_n_port_context_encode(
uint8_t * apdu,
uint8_t tag_number,
BACNET_HOST_N_PORT *address);
BACNET_STACK_EXPORT
int host_n_port_decode(uint8_t *apdu,
uint32_t apdu_len,
BACNET_ERROR_CODE *error_code,
BACNET_HOST_N_PORT *address);
BACNET_STACK_EXPORT
bool host_n_port_copy(
BACNET_HOST_N_PORT * dst,
BACNET_HOST_N_PORT * src);
BACNET_STACK_EXPORT
bool host_n_port_same(
BACNET_HOST_N_PORT * dst,
BACNET_HOST_N_PORT * src);
BACNET_STACK_EXPORT
bool host_n_port_from_ascii(
BACNET_HOST_N_PORT *value,
const char *argv);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif