Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export only public symbols #565

Merged
merged 1 commit into from
Mar 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions lcm/lcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ struct _lcm_subscription_t {
int num_queued_messages;
};

extern void lcm_udpm_provider_init(GPtrArray *providers);
extern void lcm_logprov_provider_init(GPtrArray *providers);
extern void lcm_tcpq_provider_init(GPtrArray *providers);
extern void lcm_mpudpm_provider_init(GPtrArray *providers);
extern void lcm_memq_provider_init(GPtrArray *providers);

lcm_t *lcm_create(const char *url)
{
#ifdef WIN32
Expand Down Expand Up @@ -349,7 +343,7 @@ int lcm_unsubscribe(lcm_t *lcm, lcm_subscription_t *subscription)

/* ==== Internal API for Providers ==== */

GPtrArray *lcm_get_handlers(lcm_t *lcm, const char *channel)
static GPtrArray *lcm_get_handlers(lcm_t *lcm, const char *channel)
{
g_rec_mutex_lock(&lcm->mutex);
GPtrArray *handlers = (GPtrArray *) g_hash_table_lookup(lcm->handlers_map, channel);
Expand Down
22 changes: 22 additions & 0 deletions lcm/lcm_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,39 @@ struct _lcm_provider_vtable_t {
int (*get_fileno)(lcm_provider_t *);
};

LCM_NO_EXPORT
int lcm_parse_url(const char *url, char **provider, char **target, GHashTable *args);

/**
* Try to enqueue a message. This may fail if there are no subscribers, or if
* all the subscribers' queues are full. The actual message contents are not
* enqueued here, only a placeholder for the message.
*/
LCM_NO_EXPORT
int lcm_try_enqueue_message(lcm_t *lcm, const char *channel);

LCM_NO_EXPORT
int lcm_has_handlers(lcm_t *lcm, const char *channel);

LCM_NO_EXPORT
int lcm_dispatch_handlers(lcm_t *lcm, lcm_recv_buf_t *buf, const char *channel);

// Each provider-init is defined in a separate source file; list them all here
// so that lcm.c can call them.

LCM_NO_EXPORT
void lcm_udpm_provider_init(GPtrArray *providers);

LCM_NO_EXPORT
void lcm_logprov_provider_init(GPtrArray *providers);

LCM_NO_EXPORT
void lcm_tcpq_provider_init(GPtrArray *providers);

LCM_NO_EXPORT
void lcm_mpudpm_provider_init(GPtrArray *providers);

LCM_NO_EXPORT
void lcm_memq_provider_init(GPtrArray *providers);

#endif
18 changes: 9 additions & 9 deletions lcm/lcm_mpudpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ struct _lcm_provider_t {
static int setup_recv_parts(lcm_mpudpm_t *lcm);
static mpudpm_socket_t *add_recv_socket(lcm_mpudpm_t *lcm, uint16_t port);
static void remove_recv_socket(lcm_mpudpm_t *lcm, mpudpm_socket_t *sock);
int lcm_mpudpm_unsubscribe(lcm_mpudpm_t *lcm, const char *channel);
static int lcm_mpudpm_unsubscribe(lcm_mpudpm_t *lcm, const char *channel);
static int publish_message_internal(lcm_mpudpm_t *lcm, const char *channel, const void *data,
unsigned int datalen);
static void publish_channel_mapping_update(lcm_mpudpm_t *lcm);
Expand Down Expand Up @@ -270,7 +270,7 @@ static void destroy_recv_parts(lcm_mpudpm_t *lcm)
}
}

void lcm_mpudpm_destroy(lcm_mpudpm_t *lcm)
static void lcm_mpudpm_destroy(lcm_mpudpm_t *lcm)
{
dbg(DBG_LCM, "closing lcm context\n");
destroy_recv_parts(lcm);
Expand Down Expand Up @@ -810,15 +810,15 @@ static void *recv_thread(void *user)
return NULL;
}

int lcm_mpudpm_get_fileno(lcm_mpudpm_t *lcm)
static int lcm_mpudpm_get_fileno(lcm_mpudpm_t *lcm)
{
if (setup_recv_parts(lcm) < 0) {
return -1;
}
return lcm->notify_pipe[0];
}

int lcm_mpudpm_subscribe(lcm_mpudpm_t *lcm, const char *channel)
static int lcm_mpudpm_subscribe(lcm_mpudpm_t *lcm, const char *channel)
{
// Set up the receive thread if we need to
if (setup_recv_parts(lcm) < 0) {
Expand Down Expand Up @@ -885,7 +885,7 @@ int lcm_mpudpm_subscribe(lcm_mpudpm_t *lcm, const char *channel)
return 0;
}

int lcm_mpudpm_unsubscribe(lcm_mpudpm_t *lcm, const char *channel)
static int lcm_mpudpm_unsubscribe(lcm_mpudpm_t *lcm, const char *channel)
{
g_mutex_lock(&lcm->receive_lock);
GSList *chan_it = NULL;
Expand Down Expand Up @@ -1237,8 +1237,8 @@ static int publish_message_internal(lcm_mpudpm_t *lcm, const char *channel, cons
}
}

int lcm_mpudpm_publish(lcm_mpudpm_t *lcm, const char *channel, const void *data,
unsigned int datalen)
static int lcm_mpudpm_publish(lcm_mpudpm_t *lcm, const char *channel, const void *data,
unsigned int datalen)
{
if (is_reserved_channel(channel)) {
fprintf(stderr,
Expand All @@ -1255,7 +1255,7 @@ int lcm_mpudpm_publish(lcm_mpudpm_t *lcm, const char *channel, const void *data,
return status;
}

int lcm_mpudpm_handle(lcm_mpudpm_t *lcm)
static int lcm_mpudpm_handle(lcm_mpudpm_t *lcm)
{
int status;
char ch;
Expand Down Expand Up @@ -1640,7 +1640,7 @@ static int setup_recv_parts(lcm_mpudpm_t *lcm)
return -1;
}

lcm_provider_t *lcm_mpudpm_create(lcm_t *parent, const char *network, const GHashTable *args)
static lcm_provider_t *lcm_mpudpm_create(lcm_t *parent, const char *network, const GHashTable *args)
{
mpudpm_params_t params;
memset(&params, 0, sizeof(mpudpm_params_t));
Expand Down
4 changes: 2 additions & 2 deletions lcm/lcm_udpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ static void _destroy_recv_parts(lcm_udpm_t *lcm)
}
}

void lcm_udpm_destroy(lcm_udpm_t *lcm)
static void lcm_udpm_destroy(lcm_udpm_t *lcm)
{
dbg(DBG_LCM, "closing lcm context\n");
_destroy_recv_parts(lcm);
Expand Down Expand Up @@ -1053,7 +1053,7 @@ static int _setup_recv_parts(lcm_udpm_t *lcm)
return -1;
}

lcm_provider_t *lcm_udpm_create(lcm_t *parent, const char *network, const GHashTable *args)
static lcm_provider_t *lcm_udpm_create(lcm_t *parent, const char *network, const GHashTable *args)
{
udpm_params_t params;
memset(&params, 0, sizeof(udpm_params_t));
Expand Down
13 changes: 13 additions & 0 deletions lcm/lcmtypes/channel_port_map_update_t.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
static int __channel_port_map_update_t_hash_computed;
static uint64_t __channel_port_map_update_t_hash;

LCM_NO_EXPORT
uint64_t __channel_port_map_update_t_hash_recursive(const __lcm_hash_ptr *p)
{
const __lcm_hash_ptr *fp;
Expand All @@ -30,6 +31,7 @@ uint64_t __channel_port_map_update_t_hash_recursive(const __lcm_hash_ptr *p)
return (hash<<1) + ((hash>>63)&1);
}

LCM_NO_EXPORT
int64_t __channel_port_map_update_t_get_hash(void)
{
if (!__channel_port_map_update_t_hash_computed) {
Expand All @@ -40,6 +42,7 @@ int64_t __channel_port_map_update_t_get_hash(void)
return __channel_port_map_update_t_hash;
}

LCM_NO_EXPORT
int __channel_port_map_update_t_encode_array(void *buf, int offset, int maxlen, const channel_port_map_update_t *p, int elements)
{
int pos = 0, element;
Expand All @@ -60,6 +63,7 @@ int __channel_port_map_update_t_encode_array(void *buf, int offset, int maxlen,
return pos;
}

LCM_NO_EXPORT
int channel_port_map_update_t_encode(void *buf, int offset, int maxlen, const channel_port_map_update_t *p)
{
int pos = 0, thislen;
Expand All @@ -74,6 +78,7 @@ int channel_port_map_update_t_encode(void *buf, int offset, int maxlen, const ch
return pos;
}

LCM_NO_EXPORT
int __channel_port_map_update_t_encoded_array_size(const channel_port_map_update_t *p, int elements)
{
int size = 0, element;
Expand All @@ -89,11 +94,13 @@ int __channel_port_map_update_t_encoded_array_size(const channel_port_map_update
return size;
}

LCM_NO_EXPORT
int channel_port_map_update_t_encoded_size(const channel_port_map_update_t *p)
{
return 8 + __channel_port_map_update_t_encoded_array_size(p, 1);
}

LCM_NO_EXPORT
int __channel_port_map_update_t_decode_array(const void *buf, int offset, int maxlen, channel_port_map_update_t *p, int elements)
{
int pos = 0, thislen, element;
Expand All @@ -114,6 +121,7 @@ int __channel_port_map_update_t_decode_array(const void *buf, int offset, int ma
return pos;
}

LCM_NO_EXPORT
int __channel_port_map_update_t_decode_array_cleanup(channel_port_map_update_t *p, int elements)
{
(void)p;
Expand All @@ -131,6 +139,7 @@ int __channel_port_map_update_t_decode_array_cleanup(channel_port_map_update_t *
return 0;
}

LCM_NO_EXPORT
int channel_port_map_update_t_decode(const void *buf, int offset, int maxlen, channel_port_map_update_t *p)
{
int pos = 0, thislen;
Expand All @@ -147,11 +156,13 @@ int channel_port_map_update_t_decode(const void *buf, int offset, int maxlen, ch
return pos;
}

LCM_NO_EXPORT
int channel_port_map_update_t_decode_cleanup(channel_port_map_update_t *p)
{
return __channel_port_map_update_t_decode_array_cleanup(p, 1);
}

LCM_NO_EXPORT
int __channel_port_map_update_t_clone_array(const channel_port_map_update_t *p, channel_port_map_update_t *q, int elements)
{
int element;
Expand All @@ -168,13 +179,15 @@ int __channel_port_map_update_t_clone_array(const channel_port_map_update_t *p,
return 0;
}

LCM_NO_EXPORT
channel_port_map_update_t *channel_port_map_update_t_copy(const channel_port_map_update_t *p)
{
channel_port_map_update_t *q = (channel_port_map_update_t*) malloc(sizeof(channel_port_map_update_t));
__channel_port_map_update_t_clone_array(p, q, 1);
return q;
}

LCM_NO_EXPORT
void channel_port_map_update_t_destroy(channel_port_map_update_t *p)
{
__channel_port_map_update_t_decode_array_cleanup(p, 1);
Expand Down
14 changes: 14 additions & 0 deletions lcm/lcmtypes/channel_port_map_update_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <stdint.h>
#include <stdlib.h>
#include "../lcm_coretypes.h"
#include "../lcm_export.h"

#ifdef __cplusplus
extern "C" {
Expand All @@ -35,11 +36,13 @@ struct _channel_port_map_update_t
* Create a deep copy of a channel_port_map_update_t.
* When no longer needed, destroy it with channel_port_map_update_t_destroy()
*/
LCM_NO_EXPORT
channel_port_map_update_t* channel_port_map_update_t_copy(const channel_port_map_update_t* to_copy);

/**
* Destroy an instance of channel_port_map_update_t created by channel_port_map_update_t_copy()
*/
LCM_NO_EXPORT
void channel_port_map_update_t_destroy(channel_port_map_update_t* to_destroy);

/**
Expand All @@ -52,6 +55,7 @@ void channel_port_map_update_t_destroy(channel_port_map_update_t* to_destroy);
* @param msg The message to encode.
* @return The number of bytes encoded, or <0 if an error occured.
*/
LCM_NO_EXPORT
int channel_port_map_update_t_encode(void *buf, int offset, int maxlen, const channel_port_map_update_t *p);

/**
Expand All @@ -66,28 +70,38 @@ int channel_port_map_update_t_encode(void *buf, int offset, int maxlen, const ch
* @param msg Output parameter where the decoded message is stored
* @return The number of bytes decoded, or <0 if an error occured.
*/
LCM_NO_EXPORT
int channel_port_map_update_t_decode(const void *buf, int offset, int maxlen, channel_port_map_update_t *msg);

/**
* Release resources allocated by channel_port_map_update_t_decode()
* @return 0
*/
LCM_NO_EXPORT
int channel_port_map_update_t_decode_cleanup(channel_port_map_update_t *p);

/**
* Check how many bytes are required to encode a message of type channel_port_map_update_t
*/
LCM_NO_EXPORT
int channel_port_map_update_t_encoded_size(const channel_port_map_update_t *p);

// LCM support functions. Users should not call these
LCM_NO_EXPORT
int64_t __channel_port_map_update_t_get_hash(void);
LCM_NO_EXPORT
uint64_t __channel_port_map_update_t_hash_recursive(const __lcm_hash_ptr *p);
LCM_NO_EXPORT
int __channel_port_map_update_t_encode_array(
void *buf, int offset, int maxlen, const channel_port_map_update_t *p, int elements);
LCM_NO_EXPORT
int __channel_port_map_update_t_decode_array(
const void *buf, int offset, int maxlen, channel_port_map_update_t *p, int elements);
LCM_NO_EXPORT
int __channel_port_map_update_t_decode_array_cleanup(channel_port_map_update_t *p, int elements);
LCM_NO_EXPORT
int __channel_port_map_update_t_encoded_array_size(const channel_port_map_update_t *p, int elements);
LCM_NO_EXPORT
int __channel_port_map_update_t_clone_array(const channel_port_map_update_t *p, channel_port_map_update_t *q, int elements);

#ifdef __cplusplus
Expand Down
Loading
Loading