Constness in transport functions
Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
bffe386f2d
commit
22965a0fd7
7 changed files with 25 additions and 25 deletions
|
@ -19,7 +19,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
enum ddsi_nearby_address_result ddsi_ipaddr_is_nearby_address (const nn_locator_t *loc, const nn_locator_t *ownloc, size_t ninterf, const struct nn_interface *interf);
|
||||
enum ddsi_locator_from_string_result ddsi_ipaddr_from_string (ddsi_tran_factory_t tran, nn_locator_t *loc, const char *str, int32_t kind);
|
||||
enum ddsi_locator_from_string_result ddsi_ipaddr_from_string (const struct ddsi_tran_factory *tran, nn_locator_t *loc, const char *str, int32_t kind);
|
||||
int ddsi_ipaddr_compare (const struct sockaddr *const sa1, const struct sockaddr *const sa2);
|
||||
char *ddsi_ipaddr_to_string (char *dst, size_t sizeof_dst, const nn_locator_t *loc, int with_port);
|
||||
void ddsi_ipaddr_to_loc (const struct ddsi_tran_factory *tran, nn_locator_t *dst, const struct sockaddr *src, int32_t kind);
|
||||
|
|
|
@ -68,9 +68,9 @@ typedef void (*ddsi_tran_unblock_listener_fn_t) (ddsi_tran_listener_t);
|
|||
typedef void (*ddsi_tran_release_listener_fn_t) (ddsi_tran_listener_t);
|
||||
typedef int (*ddsi_tran_join_mc_fn_t) (ddsi_tran_conn_t, const nn_locator_t *srcip, const nn_locator_t *mcip, const struct nn_interface *interf);
|
||||
typedef int (*ddsi_tran_leave_mc_fn_t) (ddsi_tran_conn_t, const nn_locator_t *srcip, const nn_locator_t *mcip, const struct nn_interface *interf);
|
||||
typedef int (*ddsi_is_mcaddr_fn_t) (ddsi_tran_factory_t tran, const nn_locator_t *loc);
|
||||
typedef int (*ddsi_is_ssm_mcaddr_fn_t) (ddsi_tran_factory_t tran, const nn_locator_t *loc);
|
||||
typedef int (*ddsi_is_valid_port_fn_t) (ddsi_tran_factory_t tran, uint32_t port);
|
||||
typedef int (*ddsi_is_mcaddr_fn_t) (const struct ddsi_tran_factory *tran, const nn_locator_t *loc);
|
||||
typedef int (*ddsi_is_ssm_mcaddr_fn_t) (const struct ddsi_tran_factory *tran, const nn_locator_t *loc);
|
||||
typedef int (*ddsi_is_valid_port_fn_t) (const struct ddsi_tran_factory *tran, uint32_t port);
|
||||
|
||||
enum ddsi_nearby_address_result {
|
||||
DNAR_DISTANT,
|
||||
|
@ -87,7 +87,7 @@ enum ddsi_locator_from_string_result {
|
|||
AFSR_MISMATCH /* recognised format, but mismatch with expected (e.g., IPv4/IPv6) */
|
||||
};
|
||||
|
||||
typedef enum ddsi_locator_from_string_result (*ddsi_locator_from_string_fn_t) (ddsi_tran_factory_t tran, nn_locator_t *loc, const char *str);
|
||||
typedef enum ddsi_locator_from_string_result (*ddsi_locator_from_string_fn_t) (const struct ddsi_tran_factory *tran, nn_locator_t *loc, const char *str);
|
||||
|
||||
typedef char * (*ddsi_locator_to_string_fn_t) (char *dst, size_t sizeof_dst, const nn_locator_t *loc, int with_port);
|
||||
|
||||
|
@ -211,7 +211,7 @@ void ddsi_factory_conn_init (const struct ddsi_tran_factory *factory, ddsi_tran_
|
|||
inline bool ddsi_factory_supports (const struct ddsi_tran_factory *factory, int32_t kind) {
|
||||
return factory->m_supports_fn (factory, kind);
|
||||
}
|
||||
inline int ddsi_is_valid_port (ddsi_tran_factory_t factory, uint32_t port) {
|
||||
inline int ddsi_is_valid_port (const struct ddsi_tran_factory *factory, uint32_t port) {
|
||||
return factory->m_is_valid_port_fn (factory, port);
|
||||
}
|
||||
inline dds_return_t ddsi_factory_create_conn (ddsi_tran_conn_t *conn, ddsi_tran_factory_t factory, uint32_t port, const struct ddsi_tran_qos *qos) {
|
||||
|
@ -234,10 +234,10 @@ inline ddsrt_socket_t ddsi_tran_handle (ddsi_tran_base_t base) {
|
|||
inline ddsrt_socket_t ddsi_conn_handle (ddsi_tran_conn_t conn) {
|
||||
return conn->m_base.m_handle_fn (&conn->m_base);
|
||||
}
|
||||
inline uint32_t ddsi_conn_type (ddsi_tran_conn_t conn) {
|
||||
inline uint32_t ddsi_conn_type (const struct ddsi_tran_conn *conn) {
|
||||
return conn->m_base.m_trantype;
|
||||
}
|
||||
inline uint32_t ddsi_conn_port (ddsi_tran_conn_t conn) {
|
||||
inline uint32_t ddsi_conn_port (const struct ddsi_tran_conn *conn) {
|
||||
return conn->m_base.m_port;
|
||||
}
|
||||
inline int ddsi_conn_locator (ddsi_tran_conn_t conn, nn_locator_t * loc) {
|
||||
|
|
|
@ -75,7 +75,7 @@ enum ddsi_nearby_address_result ddsi_ipaddr_is_nearby_address (const nn_locator_
|
|||
return DNAR_DISTANT;
|
||||
}
|
||||
|
||||
enum ddsi_locator_from_string_result ddsi_ipaddr_from_string (ddsi_tran_factory_t tran, nn_locator_t *loc, const char *str, int32_t kind)
|
||||
enum ddsi_locator_from_string_result ddsi_ipaddr_from_string (const struct ddsi_tran_factory *tran, nn_locator_t *loc, const char *str, int32_t kind)
|
||||
{
|
||||
DDSRT_WARNING_MSVC_OFF(4996);
|
||||
char copy[264];
|
||||
|
|
|
@ -291,14 +291,14 @@ static void ddsi_raweth_release_conn (ddsi_tran_conn_t conn)
|
|||
ddsrt_free (conn);
|
||||
}
|
||||
|
||||
static int ddsi_raweth_is_mcaddr (const ddsi_tran_factory_t tran, const nn_locator_t *loc)
|
||||
static int ddsi_raweth_is_mcaddr (const struct ddsi_tran_factory *tran, const nn_locator_t *loc)
|
||||
{
|
||||
(void) tran;
|
||||
assert (loc->kind == NN_LOCATOR_KIND_RAWETH);
|
||||
return (loc->address[10] & 1);
|
||||
}
|
||||
|
||||
static int ddsi_raweth_is_ssm_mcaddr (const ddsi_tran_factory_t tran, const nn_locator_t *loc)
|
||||
static int ddsi_raweth_is_ssm_mcaddr (const struct ddsi_tran_factory *tran, const nn_locator_t *loc)
|
||||
{
|
||||
(void) tran;
|
||||
(void) loc;
|
||||
|
@ -314,7 +314,7 @@ static enum ddsi_nearby_address_result ddsi_raweth_is_nearby_address (const nn_l
|
|||
return DNAR_LOCAL;
|
||||
}
|
||||
|
||||
static enum ddsi_locator_from_string_result ddsi_raweth_address_from_string (ddsi_tran_factory_t tran, nn_locator_t *loc, const char *str)
|
||||
static enum ddsi_locator_from_string_result ddsi_raweth_address_from_string (const struct ddsi_tran_factory *tran, nn_locator_t *loc, const char *str)
|
||||
{
|
||||
int i = 0;
|
||||
(void)tran;
|
||||
|
@ -356,7 +356,7 @@ static int ddsi_raweth_enumerate_interfaces (ddsi_tran_factory_t fact, enum tran
|
|||
return ddsrt_getifaddrs(ifs, afs);
|
||||
}
|
||||
|
||||
static int ddsi_raweth_is_valid_port (ddsi_tran_factory_t fact, uint32_t port)
|
||||
static int ddsi_raweth_is_valid_port (const struct ddsi_tran_factory *fact, uint32_t port)
|
||||
{
|
||||
(void) fact;
|
||||
return (port >= 1 && port <= 65535);
|
||||
|
|
|
@ -1114,19 +1114,19 @@ static void ddsi_tcp_release_factory (struct ddsi_tran_factory *fact_cmn)
|
|||
ddsrt_free (fact);
|
||||
}
|
||||
|
||||
static enum ddsi_locator_from_string_result ddsi_tcp_address_from_string (ddsi_tran_factory_t fact, nn_locator_t *loc, const char *str)
|
||||
static enum ddsi_locator_from_string_result ddsi_tcp_address_from_string (const struct ddsi_tran_factory *fact, nn_locator_t *loc, const char *str)
|
||||
{
|
||||
return ddsi_ipaddr_from_string(fact, loc, str, fact->m_kind);
|
||||
}
|
||||
|
||||
static int ddsi_tcp_is_mcaddr (const ddsi_tran_factory_t tran, const nn_locator_t *loc)
|
||||
static int ddsi_tcp_is_mcaddr (const struct ddsi_tran_factory *tran, const nn_locator_t *loc)
|
||||
{
|
||||
(void) tran;
|
||||
(void) loc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ddsi_tcp_is_ssm_mcaddr (const ddsi_tran_factory_t tran, const nn_locator_t *loc)
|
||||
static int ddsi_tcp_is_ssm_mcaddr (const struct ddsi_tran_factory *tran, const nn_locator_t *loc)
|
||||
{
|
||||
(void) tran;
|
||||
(void) loc;
|
||||
|
@ -1138,7 +1138,7 @@ static enum ddsi_nearby_address_result ddsi_tcp_is_nearby_address (const nn_loca
|
|||
return ddsi_ipaddr_is_nearby_address(loc, ownloc, ninterf, interf);
|
||||
}
|
||||
|
||||
static int ddsi_tcp_is_valid_port (ddsi_tran_factory_t fact, uint32_t port)
|
||||
static int ddsi_tcp_is_valid_port (const struct ddsi_tran_factory *fact, uint32_t port)
|
||||
{
|
||||
(void) fact;
|
||||
return (port <= 65535);
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
#include "dds/ddsi/q_log.h"
|
||||
#include "dds/ddsi/ddsi_domaingv.h"
|
||||
|
||||
extern inline uint32_t ddsi_conn_type (ddsi_tran_conn_t conn);
|
||||
extern inline uint32_t ddsi_conn_port (ddsi_tran_conn_t conn);
|
||||
extern inline uint32_t ddsi_conn_type (const struct ddsi_tran_conn *conn);
|
||||
extern inline uint32_t ddsi_conn_port (const struct ddsi_tran_conn *conn);
|
||||
extern inline dds_return_t ddsi_factory_create_listener (ddsi_tran_listener_t *listener, ddsi_tran_factory_t factory, uint32_t port, const struct ddsi_tran_qos *qos);
|
||||
extern inline bool ddsi_factory_supports (const struct ddsi_tran_factory *factory, int32_t kind);
|
||||
extern inline int ddsi_is_valid_port (ddsi_tran_factory_t factory, uint32_t port);
|
||||
extern inline int ddsi_is_valid_port (const struct ddsi_tran_factory *factory, uint32_t port);
|
||||
extern inline ddsrt_socket_t ddsi_conn_handle (ddsi_tran_conn_t conn);
|
||||
extern inline int ddsi_conn_locator (ddsi_tran_conn_t conn, nn_locator_t * loc);
|
||||
extern inline ddsrt_socket_t ddsi_tran_handle (ddsi_tran_base_t base);
|
||||
|
|
|
@ -658,7 +658,7 @@ static void ddsi_udp_release_conn (ddsi_tran_conn_t conn_cmn)
|
|||
ddsrt_free (conn_cmn);
|
||||
}
|
||||
|
||||
static int ddsi_udp_is_mcaddr (const ddsi_tran_factory_t tran, const nn_locator_t *loc)
|
||||
static int ddsi_udp_is_mcaddr (const struct ddsi_tran_factory *tran, const nn_locator_t *loc)
|
||||
{
|
||||
(void) tran;
|
||||
switch (loc->kind)
|
||||
|
@ -684,7 +684,7 @@ static int ddsi_udp_is_mcaddr (const ddsi_tran_factory_t tran, const nn_locator_
|
|||
}
|
||||
|
||||
#ifdef DDSI_INCLUDE_SSM
|
||||
static int ddsi_udp_is_ssm_mcaddr (const ddsi_tran_factory_t tran, const nn_locator_t *loc)
|
||||
static int ddsi_udp_is_ssm_mcaddr (const struct ddsi_tran_factory *tran, const nn_locator_t *loc)
|
||||
{
|
||||
(void) tran;
|
||||
switch (loc->kind)
|
||||
|
@ -706,7 +706,7 @@ static int ddsi_udp_is_ssm_mcaddr (const ddsi_tran_factory_t tran, const nn_loca
|
|||
}
|
||||
#endif
|
||||
|
||||
static enum ddsi_locator_from_string_result mcgen_address_from_string (ddsi_tran_factory_t tran, nn_locator_t *loc, const char *str)
|
||||
static enum ddsi_locator_from_string_result mcgen_address_from_string (const struct ddsi_tran_factory *tran, nn_locator_t *loc, const char *str)
|
||||
{
|
||||
// check for UDPv4MCGEN string, be lazy and refuse to recognize as a MCGEN form if there's anything "wrong" with it
|
||||
DDSRT_WARNING_MSVC_OFF(4996);
|
||||
|
@ -755,7 +755,7 @@ static enum ddsi_locator_from_string_result mcgen_address_from_string (ddsi_tran
|
|||
DDSRT_WARNING_MSVC_ON(4996);
|
||||
}
|
||||
|
||||
static enum ddsi_locator_from_string_result ddsi_udp_address_from_string (ddsi_tran_factory_t tran, nn_locator_t *loc, const char *str)
|
||||
static enum ddsi_locator_from_string_result ddsi_udp_address_from_string (const struct ddsi_tran_factory *tran, nn_locator_t *loc, const char *str)
|
||||
{
|
||||
if (tran->m_kind == TRANS_UDP && mcgen_address_from_string (tran, loc, str) == AFSR_OK)
|
||||
return AFSR_OK;
|
||||
|
@ -798,7 +798,7 @@ static void ddsi_udp_fini (ddsi_tran_factory_t fact)
|
|||
ddsrt_free (fact);
|
||||
}
|
||||
|
||||
static int ddsi_udp_is_valid_port (ddsi_tran_factory_t fact, uint32_t port)
|
||||
static int ddsi_udp_is_valid_port (const struct ddsi_tran_factory *fact, uint32_t port)
|
||||
{
|
||||
(void) fact;
|
||||
return (port <= 65535);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue