Provide getter for broadcast BIP socket (#350)

This commit is contained in:
Alexander Wells
2022-10-24 19:44:42 +01:00
committed by GitHub
parent de454a8d5c
commit 5b30674215
5 changed files with 42 additions and 1 deletions
+11
View File
@@ -84,12 +84,23 @@ static void debug_print_ipv4(const char *str,
/** /**
* @brief Return the active BIP socket. * @brief Return the active BIP socket.
* @return The active BIP socket, or -1 if uninitialized. * @return The active BIP socket, or -1 if uninitialized.
* @see bip_get_broadcast_socket
*/ */
int bip_get_socket(void) int bip_get_socket(void)
{ {
return BIP_Socket; return BIP_Socket;
} }
/**
* @brief Return the active BIP Broadcast socket.
* @return The active BIP Broadcast socket, or -1 if uninitialized.
* @see bip_get_socket
*/
int bip_get_broadcast_socket(void)
{
return BIP_Broadcast_Socket;
}
/** /**
* @brief Enabled debug printing of BACnet/IPv4 * @brief Enabled debug printing of BACnet/IPv4
*/ */
+10 -1
View File
@@ -95,16 +95,25 @@ static void debug_print_ipv4(const char *str,
} }
} }
/** /**
* @brief Return the active BIP socket. * @brief Return the active BIP socket.
* @return The active BIP socket, or -1 if uninitialized. * @return The active BIP socket, or -1 if uninitialized.
* @see bip_get_broadcast_socket
*/ */
int bip_get_socket(void) int bip_get_socket(void)
{ {
return BIP_Socket; return BIP_Socket;
} }
/**
* @brief Return the active BIP Broadcast socket.
* @return The active BIP Broadcast socket, or -1 if uninitialized.
* @see bip_get_socket
*/
int bip_get_broadcast_socket(void)
{
return BIP_Broadcast_Socket;
}
/** /**
* @brief Enabled debug printing of BACnet/IPv4 * @brief Enabled debug printing of BACnet/IPv4
+13
View File
@@ -89,12 +89,25 @@ static void debug_print_ipv4(const char *str,
* @return The active BIP socket, or INVALID_SOCKET if uninitialized. * @return The active BIP socket, or INVALID_SOCKET if uninitialized.
* @note Strictly, the return type should be SOCKET, however in practice * @note Strictly, the return type should be SOCKET, however in practice
* Windows never returns values large enough that truncation is an issue. * Windows never returns values large enough that truncation is an issue.
* @see bip_get_broadcast_socket
*/ */
int bip_get_socket(void) int bip_get_socket(void)
{ {
return (int)BIP_Socket; return (int)BIP_Socket;
} }
/**
* @brief Return the active BIP Broadcast socket.
* @return The active BIP Broadcast socket, or INVALID_SOCKET if uninitialized.
* @note Strictly, the return type should be SOCKET, however in practice
* Windows never returns values large enough that truncation is an issue.
* @see bip_get_socket
*/
int bip_get_broadcast_socket(void)
{
return (int)BIP_Broadcast_Socket;
}
/** /**
* @brief Enabled debug printing of BACnet/IPv4 * @brief Enabled debug printing of BACnet/IPv4
*/ */
+3
View File
@@ -119,6 +119,9 @@ extern "C" {
BACNET_STACK_EXPORT BACNET_STACK_EXPORT
int bip_get_socket(void); int bip_get_socket(void);
BACNET_STACK_EXPORT
int bip_get_broadcast_socket(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
+5
View File
@@ -133,3 +133,8 @@ int bip_get_socket(void)
{ {
return ztest_get_return_value(); return ztest_get_return_value();
} }
int bip_get_broadcast_socket(void)
{
return ztest_get_return_value();
}