Commit 87e639f1 authored by Pekka Pessi's avatar Pekka Pessi

Added SOFIAPUBFUN and SOFIAPUBVAR to public include files in su module.

darcs-hash:20060503135600-65a35-4b9af19e5563371249904873c6e03ca1db34b765.gz
parent 77b124f5
......@@ -227,35 +227,37 @@ typedef struct su_iovec_s su_iovec_t;
/* ---------------------------------------------------------------------- */
/* Socket compatibility functions */
int su_init(void);
void su_deinit(void);
SOFIAPUBFUN int su_init(void);
SOFIAPUBFUN void su_deinit(void);
/** Create an endpoint for communication. */
su_socket_t su_socket(int af, int sock, int proto);
SOFIAPUBFUN su_socket_t su_socket(int af, int sock, int proto);
/** Close an socket descriptor. */
int su_close(su_socket_t s);
SOFIAPUBFUN int su_close(su_socket_t s);
/** Control socket. */
int su_ioctl(su_socket_t s, int request, ...);
SOFIAPUBFUN int su_ioctl(su_socket_t s, int request, ...);
/** Checks if the previous call failed because it would have blocked. */
int su_isblocking(void);
SOFIAPUBFUN int su_isblocking(void);
/** Set/reset blocking option. */
int su_setblocking(su_socket_t s, int blocking);
SOFIAPUBFUN int su_setblocking(su_socket_t s, int blocking);
/** Set/reset address reusing option. */
int su_setreuseaddr(su_socket_t s, int reuse);
SOFIAPUBFUN int su_setreuseaddr(su_socket_t s, int reuse);
/** Get the error code associated with the socket. */
int su_soerror(su_socket_t s);
SOFIAPUBFUN int su_soerror(su_socket_t s);
/** Get size of message available in socket. */
int su_getmsgsize(su_socket_t s);
SOFIAPUBFUN int su_getmsgsize(su_socket_t s);
/** Scatter-gather send. */
SOFIAPUBFUN
int su_vsend(su_socket_t s, su_iovec_t const iov[], int iovlen, int flags,
su_sockaddr_t const *su, socklen_t sulen);
/** Scatter-gather receive. */
SOFIAPUBFUN
int su_vrecv(su_socket_t s, su_iovec_t iov[], int iovlen, int flags,
su_sockaddr_t *su, socklen_t *sulen);
/** Return local IP address */
int su_getlocalip(su_sockaddr_t *sin);
SOFIAPUBFUN int su_getlocalip(su_sockaddr_t *sin);
#include <sofia-sip/su_addrinfo.h>
......@@ -265,8 +267,9 @@ int su_getlocalip(su_sockaddr_t *sin);
#endif
#if SU_HAVE_WINSOCK
int inet_pton(int af, char const *src, void *dst);
const char *inet_ntop(int af, void const *src, char *dst, size_t size);
SOFIAPUBFUN int inet_pton(int af, char const *src, void *dst);
SOFIAPUBFUN const char *inet_ntop(int af, void const *src,
char *dst, size_t size);
#endif
/* ---------------------------------------------------------------------- */
......@@ -359,9 +362,11 @@ extern const struct in_addr6 *su_in6addr_loopback(void);
#endif
#endif /* SU_HAVE_IN6 */
int su_cmp_sockaddr(su_sockaddr_t const *a, su_sockaddr_t const *b);
int su_match_sockaddr(su_sockaddr_t const *a, su_sockaddr_t const *b);
void su_canonize_sockaddr(su_sockaddr_t *su);
SOFIAPUBFUN int su_cmp_sockaddr(su_sockaddr_t const *a,
su_sockaddr_t const *b);
SOFIAPUBFUN int su_match_sockaddr(su_sockaddr_t const *a,
su_sockaddr_t const *b);
SOFIAPUBFUN void su_canonize_sockaddr(su_sockaddr_t *su);
#if SU_HAVE_IN6
#define SU_CANONIZE_SOCKADDR(su) \
......
......@@ -121,22 +121,23 @@ struct addrinfo {
typedef struct addrinfo su_addrinfo_t;
/** Translate address and service. */
SOFIAPUBFUN
int su_getaddrinfo(char const *node, char const *service,
su_addrinfo_t const *hints,
su_addrinfo_t **res);
/** Free su_addrinfo_t structure allocated by su_getaddrinfo(). */
void su_freeaddrinfo(su_addrinfo_t *res);
SOFIAPUBFUN void su_freeaddrinfo(su_addrinfo_t *res);
/** Return string describing address translation error. */
char const *su_gai_strerror(int errcode);
SOFIAPUBFUN char const *su_gai_strerror(int errcode);
union su_sockaddr_u;
int
su_getnameinfo(const union su_sockaddr_u *su, size_t sulen,
char *host, size_t hostlen,
char *serv, size_t servlen,
int flags);
SOFIAPUBFUN
int su_getnameinfo(const union su_sockaddr_u *su, size_t sulen,
char *host, size_t hostlen,
char *serv, size_t servlen,
int flags);
SOFIA_END_DECLS
......
......@@ -42,17 +42,17 @@ SOFIA_BEGIN_DECLS
typedef struct bw_fwd_table bm_fwd_table_t;
bm_fwd_table_t *bm_memmem_study(char const *needle, size_t nlen);
SOFIAPUBFUN bm_fwd_table_t *bm_memmem_study(char const *needle, size_t nlen);
char const* bm_memmem(char const *haystack, size_t hlen,
char const *needle, size_t nlen,
bm_fwd_table_t *fwd);
SOFIAPUBFUN char const* bm_memmem(char const *haystack, size_t hlen,
char const *needle, size_t nlen,
bm_fwd_table_t *fwd);
bm_fwd_table_t *bm_memcasemem_study(char const *needle, size_t nlen);
SOFIAPUBFUN bm_fwd_table_t *bm_memcasemem_study(char const *needle, size_t);
char const* bm_memcasemem(char const *haystack, size_t hlen,
char const *needle, size_t nlen,
bm_fwd_table_t *fwd);
SOFIAPUBFUN char const* bm_memcasemem(char const *haystack, size_t hlen,
char const *needle, size_t nlen,
bm_fwd_table_t *fwd);
SOFIA_END_DECLS
......
......@@ -70,7 +70,7 @@ SOFIA_BEGIN_DECLS
#ifndef SU_LOG
#define SU_LOG (su_log_default)
#else
extern su_log_t SU_LOG[];
SOFIAPUBVAR su_log_t SU_LOG[];
#endif
#define SU_DEBUG_DEF(level) \
......
......@@ -44,13 +44,13 @@
SOFIA_BEGIN_DECLS
/** Return string describing su error code. */
char const *su_strerror(int e);
SOFIAPUBFUN char const *su_strerror(int e);
/** The latest su error. */
int su_errno(void);
SOFIAPUBFUN int su_errno(void);
/** Set the su error. */
int su_seterrno(int);
SOFIAPUBFUN int su_seterrno(int);
#if !SU_HAVE_WINSOCK
#define su_errno() (errno)
......
......@@ -90,16 +90,17 @@ enum {
};
/** Request local address information */
int su_getlocalinfo(su_localinfo_t const *hints, su_localinfo_t **res);
SOFIAPUBFUN int su_getlocalinfo(su_localinfo_t const *hints,
su_localinfo_t **res);
/** Free local address information */
void su_freelocalinfo(su_localinfo_t *);
SOFIAPUBFUN void su_freelocalinfo(su_localinfo_t *);
/** Describe su_localinfo errors. */
char const *su_gli_strerror(int error);
SOFIAPUBFUN char const *su_gli_strerror(int error);
/** Copy a localinfo structure */
su_localinfo_t *su_copylocalinfo(su_localinfo_t const *li0);
SOFIAPUBFUN su_localinfo_t *su_copylocalinfo(su_localinfo_t const *li0);
/** Return the scope of address in the sockaddr structure */
int su_sockaddr_scope(su_sockaddr_t const *su, socklen_t sulen);
SOFIAPUBFUN int su_sockaddr_scope(su_sockaddr_t const *su, socklen_t sulen);
SOFIA_END_DECLS
......
......@@ -76,26 +76,26 @@ enum { SU_LOG_MAX = 9 };
#define SU_LOG_INIT(name, env, level) \
{ sizeof(su_log_t), name, env, level, SU_LOG_MAX, 0, NULL, NULL, }
void su_log(char const *fmt, ...)
__attribute__ ((__format__ (printf, 1, 2)));
SOFIAPUBFUN void su_log(char const *fmt, ...)
__attribute__ ((__format__ (printf, 1, 2)));
void su_llog(su_log_t *log, unsigned level, char const *fmt, ...)
__attribute__ ((__format__ (printf, 3, 4)));
void su_vllog(su_log_t *log, unsigned level,
char const *fmt, va_list ap);
void su_log_redirect(su_log_t *log, su_logger_f *f, void *stream);
void su_log_set_level(su_log_t *log, unsigned level);
void su_log_soft_set_level(su_log_t *log, unsigned level);
void su_log_init(su_log_t *log);
SOFIAPUBFUN void su_llog(su_log_t *log, unsigned level, char const *fmt, ...)
__attribute__ ((__format__ (printf, 3, 4)));
SOFIAPUBFUN void su_vllog(su_log_t *log, unsigned level,
char const *fmt, va_list ap);
SOFIAPUBFUN void su_log_redirect(su_log_t *log, su_logger_f *f, void *stream);
SOFIAPUBFUN void su_log_set_level(su_log_t *log, unsigned level);
SOFIAPUBFUN void su_log_soft_set_level(su_log_t *log, unsigned level);
SOFIAPUBFUN void su_log_init(su_log_t *log);
extern su_log_t su_log_default[];
extern su_log_t su_log_global[];
SOFIAPUBVAR su_log_t su_log_default[];
SOFIAPUBVAR su_log_t su_log_global[];
/** Log the latest su error message */
void su_perror(char const *s);
SOFIAPUBFUN void su_perror(char const *s);
/** Log the su error message. */
void su_perror2(char const *s, int errcode);
SOFIAPUBFUN void su_perror2(char const *s, int errcode);
SOFIA_END_DECLS
......
......@@ -57,20 +57,22 @@ typedef struct su_md5_t {
#define SU_MD5_DIGEST_SIZE 16
void su_md5_init(su_md5_t *context);
void su_md5_deinit(su_md5_t *context);
void su_md5_update(su_md5_t *context, void const *buf, unsigned len);
void su_md5_strupdate(su_md5_t *ctx, char const *s);
void su_md5_str0update(su_md5_t *ctx, char const *s);
SOFIAPUBFUN void su_md5_init(su_md5_t *context);
SOFIAPUBFUN void su_md5_deinit(su_md5_t *context);
SOFIAPUBFUN void su_md5_update(su_md5_t *context,
void const *buf, unsigned len);
SOFIAPUBFUN void su_md5_strupdate(su_md5_t *ctx, char const *s);
SOFIAPUBFUN void su_md5_str0update(su_md5_t *ctx, char const *s);
void su_md5_iupdate(su_md5_t *context, void const *buf, unsigned len);
void su_md5_striupdate(su_md5_t *ctx, char const *s);
void su_md5_stri0update(su_md5_t *ctx, char const *s);
SOFIAPUBFUN void su_md5_iupdate(su_md5_t *context,
void const *buf, unsigned len);
SOFIAPUBFUN void su_md5_striupdate(su_md5_t *ctx, char const *s);
SOFIAPUBFUN void su_md5_stri0update(su_md5_t *ctx, char const *s);
void su_md5_digest(su_md5_t const *ctx, uint8_t digest[SU_MD5_DIGEST_SIZE]);
void su_md5_hexdigest(su_md5_t const *ctx,
char digest[2 * SU_MD5_DIGEST_SIZE + 1]);
SOFIAPUBFUN void su_md5_digest(su_md5_t const *ctx,
uint8_t digest[SU_MD5_DIGEST_SIZE]);
SOFIAPUBFUN void su_md5_hexdigest(su_md5_t const *ctx,
char digest[2 * SU_MD5_DIGEST_SIZE + 1]);
#define SU_MD5_STRUPDATE(ctx, s) \
((s) ? su_md5_update(ctx, (s), strlen(s)) : (void)0)
......
......@@ -78,16 +78,16 @@ struct tag_type_s {
typedef struct tag_type_s const tag_typedef_t[1];
/** End of tag list */
SU_DLL extern tag_typedef_t tag_null;
SOFIAPUBVAR tag_typedef_t tag_null;
/** Ignore tag item. */
SU_DLL extern tag_typedef_t tag_skip;
SOFIAPUBVAR tag_typedef_t tag_skip;
/** Jump to another tag list */
SU_DLL extern tag_typedef_t tag_next;
SOFIAPUBVAR tag_typedef_t tag_next;
/** Any tag accepted when filtering. */
SU_DLL extern tag_typedef_t tag_any;
SOFIAPUBVAR tag_typedef_t tag_any;
/** @HI Initialize a tag item marking the end of list. */
#define TAG_NULL() (tag_type_t)0, (tag_value_t)0
......@@ -109,43 +109,45 @@ SU_DLL extern tag_typedef_t tag_any;
#define TAG_IF(condition, item) !(condition) ? tag_skip : item
/** Convert tag item to a string */
int t_snprintf(tagi_t const *t, char b[], size_t size);
SOFIAPUBFUN int t_snprintf(tagi_t const *t, char b[], size_t size);
/** Convert string to a tag value */
int t_scan(tag_type_t tt, su_home_t *home, char const *s,
tag_value_t *return_value);
SOFIAPUBFUN int t_scan(tag_type_t tt, su_home_t *home, char const *s,
tag_value_t *return_value);
/* Tagarg functions */
tagi_t *tl_tlist(su_home_t *, tag_type_t tag, tag_value_t value, ...);
size_t tl_tmove(tagi_t *dst, size_t size, tag_type_t tt, tag_value_t v, ...);
int tl_gets(tagi_t const lst[], tag_type_t tag, tag_value_t value, ...);
int tl_tgets(tagi_t lst[], tag_type_t tag, tag_value_t value, ...);
tagi_t *tl_tfilter(su_home_t *, tagi_t const lst[],
tag_type_t t, tag_value_t v, ...);
int tl_tremove(tagi_t lst[], tag_type_t tag, tag_value_t value, ...);
SOFIAPUBFUN tagi_t *tl_tlist(su_home_t *, tag_type_t, tag_value_t, ...);
SOFIAPUBFUN size_t tl_tmove(tagi_t *dst, size_t, tag_type_t, tag_value_t, ...);
SOFIAPUBFUN int tl_gets(tagi_t const lst[], tag_type_t, tag_value_t, ...);
SOFIAPUBFUN int tl_tgets(tagi_t lst[], tag_type_t, tag_value_t, ...);
SOFIAPUBFUN tagi_t *tl_tfilter(su_home_t *, tagi_t const lst[],
tag_type_t, tag_value_t, ...);
SOFIAPUBFUN int tl_tremove(tagi_t lst[], tag_type_t, tag_value_t, ...);
/* Low-level taglist manipulation functions */
size_t tl_len(tagi_t const lst[]);
size_t tl_xtra(tagi_t const lst[], size_t offset);
tagi_t *tl_next(tagi_t const *lst);
tagi_t *tl_move(tagi_t *dst, tagi_t const src[]);
tagi_t *tl_dup(tagi_t dst[], tagi_t const lst[], void **bb);
tagi_t *tl_adup(su_home_t *, tagi_t const lst[]);
tagi_t const *tl_find(tagi_t const lst[], tag_type_t tt);
tagi_t *tl_filter(tagi_t *, tagi_t const filter[], tagi_t const lst[], void **b);
tagi_t *tl_afilter(su_home_t *, tagi_t const filter[], tagi_t const lst[]);
tagi_t *tl_filtered_tlist(su_home_t *home, tagi_t const filter[],
tag_type_t tag, tag_value_t value, ...);
size_t tl_vlen(va_list ap);
tagi_t *tl_list(tag_type_t tag, tag_value_t value, ...);
tagi_t *tl_vlist2(tag_type_t tag, tag_value_t value, va_list ap);
tagi_t *tl_vlist(va_list ap);
tagi_t *tl_llist(tag_type_t tag, tag_value_t value, ...);
tagi_t *tl_vllist(tag_type_t tag, tag_value_t value, va_list ap);
void tl_vfree(tagi_t *t);
SOFIAPUBFUN size_t tl_len(tagi_t const lst[]);
SOFIAPUBFUN size_t tl_xtra(tagi_t const lst[], size_t offset);
SOFIAPUBFUN tagi_t *tl_next(tagi_t const *lst);
SOFIAPUBFUN tagi_t *tl_move(tagi_t *dst, tagi_t const src[]);
SOFIAPUBFUN tagi_t *tl_dup(tagi_t dst[], tagi_t const lst[], void **bb);
SOFIAPUBFUN tagi_t *tl_adup(su_home_t *, tagi_t const lst[]);
SOFIAPUBFUN tagi_t const *tl_find(tagi_t const lst[], tag_type_t tt);
SOFIAPUBFUN tagi_t *tl_filter(tagi_t *, tagi_t const filter[],
tagi_t const lst[], void **b);
SOFIAPUBFUN tagi_t *tl_afilter(su_home_t *, tagi_t const filter[],
tagi_t const lst[]);
SOFIAPUBFUN tagi_t *tl_filtered_tlist(su_home_t *home, tagi_t const filter[],
tag_type_t, tag_value_t, ...);
SOFIAPUBFUN size_t tl_vlen(va_list ap);
SOFIAPUBFUN tagi_t *tl_list(tag_type_t tag, tag_value_t value, ...);
SOFIAPUBFUN tagi_t *tl_vlist2(tag_type_t tag, tag_value_t value, va_list ap);
SOFIAPUBFUN tagi_t *tl_vlist(va_list ap);
SOFIAPUBFUN tagi_t *tl_llist(tag_type_t tag, tag_value_t value, ...);
SOFIAPUBFUN tagi_t *tl_vllist(tag_type_t tag, tag_value_t value, va_list ap);
SOFIAPUBFUN void tl_vfree(tagi_t *t);
/** Align to pointer size */
#define SU_ALIGN(x) \
......
......@@ -76,40 +76,45 @@ struct tag_class_s {
tag_value_t *return_value);
};
SU_DLL extern tag_class_t end_tag_class[];
SU_DLL extern tag_class_t int_tag_class[];
SU_DLL extern tag_class_t uint_tag_class[];
SU_DLL extern tag_class_t bool_tag_class[];
SU_DLL extern tag_class_t ptr_tag_class[];
SU_DLL extern tag_class_t cstr_tag_class[];
SU_DLL extern tag_class_t str_tag_class[];
SU_DLL extern tag_class_t ns_tag_class[];
SOFIAPUBVAR tag_class_t end_tag_class[];
SOFIAPUBVAR tag_class_t int_tag_class[];
SOFIAPUBVAR tag_class_t uint_tag_class[];
SOFIAPUBVAR tag_class_t bool_tag_class[];
SOFIAPUBVAR tag_class_t ptr_tag_class[];
SOFIAPUBVAR tag_class_t cstr_tag_class[];
SOFIAPUBVAR tag_class_t str_tag_class[];
SOFIAPUBVAR tag_class_t ns_tag_class[];
#define REFTAG_TYPEDEF(tag) \
{{ TAG_NAMESPACE, #tag "_ref", ref_tag_class, (tag_value_t)tag }}
SU_DLL extern tag_class_t ref_tag_class[];
SOFIAPUBVAR tag_class_t ref_tag_class[];
SU_DLL int t_ptr_snprintf(tagi_t const *t, char b[], size_t size);
SU_DLL int t_ptr_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
SU_DLL int t_ptr_scan(tag_type_t, su_home_t *, char const *, tag_value_t *);
SOFIAPUBFUN int t_ptr_snprintf(tagi_t const *t, char b[], size_t size);
SOFIAPUBFUN int t_ptr_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
SOFIAPUBFUN int t_ptr_scan(tag_type_t, su_home_t *, char const *,
tag_value_t *return_value);
SU_DLL int t_bool_snprintf(tagi_t const *t, char b[], size_t size);
SU_DLL int t_bool_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
SU_DLL int t_bool_scan(tag_type_t, su_home_t *, char const *, tag_value_t *);
SOFIAPUBFUN int t_bool_snprintf(tagi_t const *t, char b[], size_t size);
SOFIAPUBFUN int t_bool_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
SOFIAPUBFUN int t_bool_scan(tag_type_t, su_home_t *, char const *,
tag_value_t *return_value);
SU_DLL int t_int_snprintf(tagi_t const *t, char b[], size_t size);
SU_DLL int t_int_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
SU_DLL int t_int_scan(tag_type_t, su_home_t *, char const *, tag_value_t *);
SOFIAPUBFUN int t_int_snprintf(tagi_t const *t, char b[], size_t size);
SOFIAPUBFUN int t_int_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
SOFIAPUBFUN int t_int_scan(tag_type_t, su_home_t *, char const *,
tag_value_t *return_value);
SU_DLL int t_uint_snprintf(tagi_t const *t, char b[], size_t size);
SU_DLL int t_uint_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
SU_DLL int t_uint_scan(tag_type_t, su_home_t *, char const *, tag_value_t *);
SOFIAPUBFUN int t_uint_snprintf(tagi_t const *t, char b[], size_t size);
SOFIAPUBFUN int t_uint_ref_set(tag_type_t tt, void *ref, tagi_t const value[]);
SOFIAPUBFUN int t_uint_scan(tag_type_t, su_home_t *, char const *,
tag_value_t *return_value);
SU_DLL tagi_t *t_str_dup(tagi_t *dst, tagi_t const *src, void **b);
SU_DLL size_t t_str_xtra(tagi_t const *t, size_t offset);
SU_DLL int t_str_snprintf(tagi_t const *t, char b[], size_t size);
SU_DLL int t_str_scan(tag_type_t, su_home_t *, char const *, tag_value_t *);
SOFIAPUBFUN tagi_t *t_str_dup(tagi_t *dst, tagi_t const *src, void **b);
SOFIAPUBFUN size_t t_str_xtra(tagi_t const *t, size_t offset);
SOFIAPUBFUN int t_str_snprintf(tagi_t const *t, char b[], size_t size);
SOFIAPUBFUN int t_str_scan(tag_type_t, su_home_t *, char const *,
tag_value_t *return_value);
SOFIA_END_DECLS
......
......@@ -41,7 +41,7 @@
SOFIA_BEGIN_DECLS
void tl_print(FILE *f, char const *title, tagi_t const lst[]);
SOFIAPUBFUN void tl_print(FILE *f, char const *title, tagi_t const lst[]);
SOFIA_END_DECLS
......
......@@ -80,28 +80,28 @@ typedef uint64_t su_ntp_t;
(t1.tv_sec - t2.tv_sec) : \
(t1.tv_usec - t2.tv_usec))
su_time_t su_now(void);
void su_time(su_time_t *tv);
long su_time_cmp(su_time_t const t1, su_time_t const t2);
double su_time_diff(su_time_t const t1, su_time_t const t2);
su_duration_t su_duration(su_time_t const t1, su_time_t const t2);
SOFIAPUBFUN su_time_t su_now(void);
SOFIAPUBFUN void su_time(su_time_t *tv);
SOFIAPUBFUN long su_time_cmp(su_time_t const t1, su_time_t const t2);
SOFIAPUBFUN double su_time_diff(su_time_t const t1, su_time_t const t2);
SOFIAPUBFUN su_duration_t su_duration(su_time_t const t1, su_time_t const t2);
su_time_t su_time_add(su_time_t t, su_duration_t dur);
su_time_t su_time_dadd(su_time_t t, double dur);
SOFIAPUBFUN su_time_t su_time_add(su_time_t t, su_duration_t dur);
SOFIAPUBFUN su_time_t su_time_dadd(su_time_t t, double dur);
int su_time_print(char *s, int n, su_time_t const *tv);
SOFIAPUBFUN int su_time_print(char *s, int n, su_time_t const *tv);
#define SU_SEC_TO_DURATION(sec) ((su_duration_t)(1000 * (sec)))
su_ntp_t su_ntp_now(void);
uint32_t su_ntp_sec(void);
uint32_t su_ntp_hi(su_ntp_t);
uint32_t su_ntp_lo(su_ntp_t);
uint32_t su_ntp_mw(su_ntp_t ntp);
SOFIAPUBFUN su_ntp_t su_ntp_now(void);
SOFIAPUBFUN uint32_t su_ntp_sec(void);
SOFIAPUBFUN uint32_t su_ntp_hi(su_ntp_t);
SOFIAPUBFUN uint32_t su_ntp_lo(su_ntp_t);
SOFIAPUBFUN uint32_t su_ntp_mw(su_ntp_t ntp);
#if !SU_HAVE_INLINE
uint32_t su_ntp_fraq(su_time_t t);
uint32_t su_time_ms(su_time_t t);
SOFIAPUBFUN uint32_t su_ntp_fraq(su_time_t t);
SOFIAPUBFUN uint32_t su_time_ms(su_time_t t);
#else
static SU_INLINE
/** Middle 32 bit of NTP timestamp. */
......@@ -123,13 +123,13 @@ uint32_t su_time_ms(su_time_t t)
}
#endif
su_ntp_t su_ntp_hilo(uint32_t hi, uint32_t lo);
SOFIAPUBFUN su_ntp_t su_ntp_hilo(uint32_t hi, uint32_t lo);
uint64_t su_counter(void);
SOFIAPUBFUN uint64_t su_counter(void);
uint64_t su_nanocounter(void);
SOFIAPUBFUN uint64_t su_nanocounter(void);
uint32_t su_random();
SOFIAPUBFUN uint32_t su_random();
SOFIA_END_DECLS
......
......@@ -57,7 +57,7 @@ typedef union GloballyUniqueIdentifier {
} su_guid_t;
/** Return node identifier */
size_t su_node_identifier(void *address, size_t addrlen);
SOFIAPUBFUN size_t su_node_identifier(void *address, size_t addrlen);
/** Generate a GUID
*
......@@ -68,7 +68,7 @@ size_t su_node_identifier(void *address, size_t addrlen);
*
* @param guid [out] pointer to structure for new call identifier
*/
void su_guid_generate(su_guid_t *guid);
SOFIAPUBFUN void su_guid_generate(su_guid_t *guid);
/** Print guid.
*
......@@ -86,7 +86,7 @@ void su_guid_generate(su_guid_t *guid);
* The function guid_sprintf() returns length of the formatted
* globally unique identifier excluding the final NUL.
*/
int su_guid_sprintf(char* buf, size_t len, su_guid_t const *guid);
SOFIAPUBFUN int su_guid_sprintf(char* buf, size_t len, su_guid_t const *guid);
enum {
/** Length of guid in hex format */
......@@ -104,7 +104,7 @@ enum {
* @return
* The function randint() returns a pseudo-random integer.
*/
int su_randint(int lb, int ub);
SOFIAPUBFUN int su_randint(int lb, int ub);
/** Fill memory with random values.
*
......@@ -113,7 +113,7 @@ int su_randint(int lb, int ub);
* @param mem [out] pointer to the beginning of the memory area to be filled
* @param siz [in] size fo the memory area in bytes
*/
void *su_randmem(void *mem, size_t siz);
SOFIAPUBFUN void *su_randmem(void *mem, size_t siz);
SOFIA_END_DECLS
......
......@@ -197,7 +197,7 @@ enum {
struct _GSource;
/** Hint for number of registered fds in su_root */
SU_DLL extern int su_root_size_hint;
SOFIAPUBVAR int su_root_size_hint;
/* ---------------------------------------------------------------------- */
/* Pre-poll callback */
......@@ -331,12 +331,12 @@ typedef void (*su_root_deinit_f)(su_root_t *, su_root_magic_t *);
/* Functions */
/* Wait */
void su_wait_init(su_wait_t dst[1]);
int su_wait_create(su_wait_t *dst, su_socket_t s, int events);
int su_wait_destroy(su_wait_t *dst);
int su_wait(su_wait_t waits[], unsigned n, su_duration_t timeout);
int su_wait_events(su_wait_t *wait, su_socket_t s);
int su_wait_mask(su_wait_t *dst, su_socket_t s, int events);
SOFIAPUBFUN void su_wait_init(su_wait_t dst[1]);
SOFIAPUBFUN int su_wait_create(su_wait_t *dst, su_socket_t s, int events);
SOFIAPUBFUN int su_wait_destroy(su_wait_t *dst);
SOFIAPUBFUN int su_wait(su_wait_t waits[], unsigned n, su_duration_t timeout);
SOFIAPUBFUN int su_wait_events(su_wait_t *wait, su_socket_t s);
SOFIAPUBFUN int su_wait_mask(su_wait_t *dst, su_socket_t s, int events);
#if SU_HAVE_BSDSOCK
static inline
......@@ -347,86 +347,89 @@ su_socket_t su_wait_socket(su_wait_t *wait)
#endif
/* Root */
su_root_t *su_root_create(su_root_magic_t *magic)
__attribute__((__malloc__));
void su_root_destroy(su_root_t*);
int su_root_set_magic(su_root_t *self, su_root_magic_t *magic);
su_root_magic_t *su_root_magic(su_root_t *root);
int su_root_register(su_root_t*, su_wait_t *,
su_wakeup_f, su_wakeup_arg_t *,
int priority);
int su_root_unregister(su_root_t*, su_wait_t *,
su_wakeup_f, su_wakeup_arg_t*);
int su_root_deregister(su_root_t*, int);
int su_root_eventmask(su_root_t *, int index, int socket, int events);
su_duration_t su_root_step(su_root_t *root, su_duration_t timeout);
su_duration_t su_root_sleep(su_root_t *root, su_duration_t duration);
int su_root_multishot(su_root_t *root, int multishot);
void su_root_run(su_root_t *root);
void su_root_break(su_root_t *root);
_su_task_r su_root_task(su_root_t const *root);
_su_task_r su_root_parent(su_root_t const *root);
int su_root_add_prepoll(su_root_t *root,
su_prepoll_f *,
su_prepoll_magic_t *);
int su_root_remove_prepoll(su_root_t *root);
struct _GSource *su_root_gsource(su_root_t *self);
SOFIAPUBFUN su_root_t *su_root_create(su_root_magic_t *magic)
__attribute__((__malloc__));
SOFIAPUBFUN void su_root_destroy(su_root_t*);
SOFIAPUBFUN int su_root_set_magic(su_root_t *self, su_root_magic_t *magic);
SOFIAPUBFUN su_root_magic_t *su_root_magic(su_root_t *root);
SOFIAPUBFUN int su_root_register(su_root_t*, su_wait_t *,
su_wakeup_f, su_wakeup_arg_t *,
int priority);
SOFIAPUBFUN int su_root_unregister(su_root_t*, su_wait_t *,
su_wakeup_f, su_wakeup_arg_t*);
SOFIAPUBFUN int su_root_deregister(su_root_t*, int);
SOFIAPUBFUN int su_root_eventmask(su_root_t *,
int index, int socket, int events);
SOFIAPUBFUN su_duration_t su_root_step(su_root_t *root, su_duration_t timeout);
SOFIAPUBFUN su_duration_t su_root_sleep(su_root_t *root, su_duration_t);
SOFIAPUBFUN int su_root_multishot(su_root_t *root, int multishot);
SOFIAPUBFUN void su_root_run(su_root_t *root);
SOFIAPUBFUN void su_root_break(su_root_t *root);
SOFIAPUBFUN _su_task_r su_root_task(su_root_t const *root);
SOFIAPUBFUN _su_task_r su_root_parent(su_root_t const *root);
SOFIAPUBFUN int su_root_add_prepoll(su_root_t *root,
su_prepoll_f *,
su_prepoll_magic_t *);
SOFIAPUBFUN int su_root_remove_prepoll(su_root_t *root);
SOFIAPUBFUN struct _GSource *su_root_gsource(su_root_t *self);
/* Timers */
su_timer_t *su_timer_create(su_task_r const, su_duration_t msec)
SOFIAPUBFUN su_timer_t *su_timer_create(su_task_r const, su_duration_t msec)
__attribute__((__malloc__));
void su_timer_destroy(su_timer_t *);
int su_timer_set(su_timer_t *, su_timer_f, su_timer_arg_t *);
int su_timer_set_interval(su_timer_t *t, su_timer_f wakeup,
su_timer_arg_t *arg, su_duration_t duration);
int su_timer_set_at(su_timer_t *, su_timer_f, su_timer_arg_t *, su_time_t);
int su_timer_run(su_timer_t *, su_timer_f, su_timer_arg_t *);
int su_timer_set_for_ever(su_timer_t *, su_timer_f, su_timer_arg_t *);
int su_timer_reset(su_timer_t *);
su_root_t *su_timer_root(su_timer_t const *);
int su_timer_expire(su_timer_t ** const,
su_duration_t *tout,
su_time_t now);
SOFIAPUBFUN void su_timer_destroy(su_timer_t *);
SOFIAPUBFUN int su_timer_set(su_timer_t *, su_timer_f, su_timer_arg_t *);
SOFIAPUBFUN int su_timer_set_interval(su_timer_t *t, su_timer_f,
su_timer_arg_t *, su_duration_t);
SOFIAPUBFUN int su_timer_set_at(su_timer_t *, su_timer_f,
su_timer_arg_t *, su_time_t);
SOFIAPUBFUN int su_timer_run(su_timer_t *, su_timer_f, su_timer_arg_t *);
SOFIAPUBFUN int su_timer_set_for_ever(su_timer_t *, su_timer_f,
su_timer_arg_t *);
SOFIAPUBFUN int su_timer_reset(su_timer_t *);
SOFIAPUBFUN su_root_t *su_timer_root(su_timer_t const *);
SOFIAPUBFUN int su_timer_expire(su_timer_t ** const,
su_duration_t *tout,
su_time_t now);
/* Tasks */
/** NULL task. */
extern su_task_r const su_task_null;
SOFIAPUBVAR su_task_r const su_task_null;
_su_task_r su_task_init(su_task_r task);
void su_task_deinit(su_task_r task);
SOFIAPUBFUN _su_task_r su_task_init(su_task_r task);
SOFIAPUBFUN void su_task_deinit(su_task_r task);
void su_task_copy(su_task_r dst, su_task_r const src);
void su_task_move(su_task_r dst, su_task_r src);
int su_task_cmp