From: Lennart Poettering Date: Wed, 12 Oct 2005 22:37:25 +0000 (+0000) Subject: add howl headers X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=c6bf0e465bceac2ef0e5f3a3ba97ae1f8b251a40;p=catta add howl headers git-svn-id: file:///home/lennart/svn/public/avahi/trunk@747 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- diff --git a/avahi-compat-howl/funcs.txt b/avahi-compat-howl/funcs.txt new file mode 100644 index 0000000..818b831 --- /dev/null +++ b/avahi-compat-howl/funcs.txt @@ -0,0 +1,179 @@ +Relevant: + +sw_discovery_init +sw_discovery_init_with_flags +sw_discovery_fina +sw_discovery_publish_host +sw_discovery_publish +sw_discovery_publish_update +sw_discovery_browse_domains +sw_discovery_browse +sw_discovery_resolve +sw_discovery_query_record +sw_discovery_cancel +sw_discovery_run +sw_discovery_stop_run +sw_discovery_socket +sw_discovery_read_socket +sw_discovery_salt + +sw_text_record_init +sw_text_record_fina +sw_text_record_add_string +sw_text_record_add_key_and_string_value +sw_text_record_add_key_and_binary_value +sw_text_record_bytes +sw_text_record_len +sw_text_record_iterator_init +sw_text_record_iterator_fina +sw_text_record_iterator_next +sw_text_record_string_iterator_init +sw_text_record_string_iterator_fina +sw_text_record_string_iterator_next + +sw_ipv4_address_any +sw_ipv4_address_loopback +sw_ipv4_address_init +sw_ipv4_address_init_from_saddr +sw_ipv4_address_init_from_name +sw_ipv4_address_init_from_address +sw_ipv4_address_init_from_this_host +sw_ipv4_address_fina +sw_ipv4_address_is_any +sw_ipv4_address_saddr +sw_ipv4_address_name +sw_ipv4_address_decompose +sw_ipv4_address_equals + +sw_salt_step + +Irrelevant: + +sw_strdup +sw_strerror +sw_timer_init +sw_timer_fina +sw_time_init +sw_time_init_now +sw_time_fina +sw_time_add +sw_time_sub +sw_time_cmp +sw_salt_init +sw_salt_fina +sw_salt_register_socket +sw_salt_unregister_socket +sw_salt_register_timer +sw_salt_unregister_timer +sw_salt_register_network_interface +sw_salt_unregister_network_interface_handler +sw_salt_register_signal +sw_salt_unregister_signal +sw_salt_lock +sw_salt_unlock +sw_salt_run +sw_salt_stop_run +sw_print_assert +sw_print_debug +sw_tcp_socket_init +sw_tcp_socket_init_with_desc +sw_udp_socket_init +sw_multicast_socket_init +sw_socket_fina +sw_socket_bind +sw_socket_join_multicast_group +sw_socket_leave_multicast_group +sw_socket_listen +sw_socket_connect +sw_socket_accept +sw_socket_send +sw_socket_sendto +sw_socket_recv +sw_socket_recvfrom +sw_socket_set_blocking_mode +sw_socket_set_options +sw_socket_ipv4_address +sw_socket_port +sw_socket_desc +sw_socket_close +sw_socket_options_init +sw_socket_options_fina +sw_socket_options_set_debug +sw_socket_options_set_nodelay +sw_socket_options_set_dontroute +sw_socket_options_set_keepalive +sw_socket_options_set_linger +sw_socket_options_set_reuseaddr +sw_socket_options_set_rcvbuf +sw_socket_options_set_sndbuf +sw_socket_error_code +sw_corby_orb_init +sw_corby_orb_fina +sw_corby_orb_register_servant +sw_corby_orb_unregister_servant +sw_corby_orb_register_bidirectional_object +sw_corby_orb_register_channel +sw_corby_orb_get_delegate +sw_corby_orb_set_delegate +sw_corby_orb_set_observer +sw_corby_orb_protocol_to_address +sw_corby_orb_protocol_to_url +sw_corby_orb_read_channel +sw_corby_orb_dispatch_message +sw_corby_message_init +sw_corby_message_fina +sw_corby_buffer_init +sw_corby_buffer_init_with_size +sw_corby_buffer_init_with_delegate +sw_corby_buffer_init_with_size_and_delegate +sw_corby_buffer_fina +sw_corby_buffer_reset +sw_corby_buffer_set_octets +sw_corby_buffer_octets +sw_corby_buffer_bytes_used +sw_corby_buffer_size +sw_corby_buffer_put_int8 +sw_corby_buffer_put_uint8 +sw_corby_buffer_put_int16 +sw_corby_buffer_put_uint16 +sw_corby_buffer_put_int32 +sw_corby_buffer_put_uint32 +sw_corby_buffer_put_octets +sw_corby_buffer_put_sized_octets +sw_corby_buffer_put_cstring +sw_corby_buffer_put_object +sw_corby_buffer_put_pad +sw_corby_buffer_get_int8 +sw_corby_buffer_get_uint8 +sw_corby_buffer_get_int16 +sw_corby_buffer_get_uint16 +sw_corby_buffer_get_int32 +sw_corby_buffer_get_uint32 +sw_corby_buffer_get_octets +sw_corby_buffer_allocate_and_get_sized_octets +sw_corby_buffer_get_zerocopy_sized_octets +sw_corby_buffer_get_sized_octets +sw_corby_buffer_allocate_and_get_cstring +sw_corby_buffer_get_zerocopy_cstring +sw_corby_buffer_get_cstring +sw_corby_buffer_get_object +sw_corby_channel_start_request +sw_corby_channel_start_reply +sw_corby_channel_send +sw_corby_channel_recv +sw_corby_channel_last_recv_from +sw_corby_channel_ff +sw_corby_channel_socket +sw_corby_channel_retain +sw_corby_channel_set_delegate +sw_corby_channel_get_delegate +sw_corby_channel_set_app_data +sw_corby_channel_get_app_data +sw_corby_channel_fina +sw_corby_object_init_from_url +sw_corby_object_fina +sw_corby_object_start_request +sw_corby_object_send +sw_corby_object_recv +sw_corby_object_channel +sw_corby_object_set_channel diff --git a/avahi-compat-howl/include/corby/buffer.h b/avahi-compat-howl/include/corby/buffer.h new file mode 100644 index 0000000..017ad5d --- /dev/null +++ b/avahi-compat-howl/include/corby/buffer.h @@ -0,0 +1,330 @@ +#ifndef _sw_corby_buffer_h +#define _sw_corby_buffer_h + +/* + * Copyright 2003, 2004 Porchdog Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of Porchdog Software. + */ + +#include +#include + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +struct _sw_corby_buffer; +typedef struct _sw_corby_buffer * sw_corby_buffer; +struct _sw_corby_object; +typedef sw_opaque sw_corby_buffer_delegate; +typedef sw_opaque sw_corby_buffer_observer; + + +typedef enum _sw_corby_buffer_pad +{ + SW_CORBY_BUFFER_PAD_NONE, + SW_CORBY_BUFFER_PAD_ALIGN_2, + SW_CORBY_BUFFER_PAD_ALIGN_4, + SW_CORBY_BUFFER_PAD_ALIGN_8, + SW_CORBY_BUFFER_PAD_ALIGN_16, + SW_CORBY_BUFFER_PAD_ALIGN_32 +} sw_corby_buffer_pad; + + +typedef sw_result +(HOWL_API* sw_corby_buffer_written_func)( + sw_corby_buffer_observer observer, + sw_corby_buffer buffer, + sw_result result, + sw_size_t bytesWritten, + sw_opaque_t extra); + + +typedef sw_result +(HOWL_API* sw_corby_buffer_overflow_func)( + sw_corby_buffer_delegate delegate, + sw_corby_buffer buffer, + sw_uint8 octet, + sw_uint8 ** base, + sw_uint8 ** bptr, + sw_uint8 ** eptr, + sw_uint8 ** end, + sw_opaque_t extra); + + +typedef sw_result +(HOWL_API* sw_corby_buffer_underflow_func)( + sw_corby_buffer_delegate delegate, + sw_corby_buffer buffer, + sw_uint8 * octet, + sw_uint8 ** base, + sw_uint8 ** bptr, + sw_uint8 ** eptr, + sw_uint8 ** end, + sw_opaque_t extra); + + +sw_result HOWL_API +sw_corby_buffer_init( + sw_corby_buffer * self); + + +sw_result HOWL_API +sw_corby_buffer_init_with_size( + sw_corby_buffer * self, + sw_size_t size); + + +sw_result HOWL_API +sw_corby_buffer_init_with_delegate( + sw_corby_buffer * self, + sw_corby_buffer_delegate delegate, + sw_corby_buffer_overflow_func overflow, + sw_corby_buffer_underflow_func underflow, + sw_opaque_t extra); + + +sw_result HOWL_API +sw_corby_buffer_init_with_size_and_delegate( + sw_corby_buffer * self, + sw_size_t size, + sw_corby_buffer_delegate delegate, + sw_corby_buffer_overflow_func overflow, + sw_corby_buffer_underflow_func underflow, + sw_opaque_t extra); + + +sw_result HOWL_API +sw_corby_buffer_fina( + sw_corby_buffer self); + + +void HOWL_API +sw_corby_buffer_reset( + sw_corby_buffer self); + + +sw_result HOWL_API +sw_corby_buffer_set_octets( + sw_corby_buffer self, + sw_octets octets, + sw_size_t size); + + +sw_octets HOWL_API +sw_corby_buffer_octets( + sw_corby_buffer self); + + +sw_size_t HOWL_API +sw_corby_buffer_bytes_used( + sw_corby_buffer self); + + +sw_size_t HOWL_API +sw_corby_buffer_size( + sw_corby_buffer self); + + +sw_result HOWL_API +sw_corby_buffer_put_int8( + sw_corby_buffer self, + sw_int8 val); + + +sw_result HOWL_API +sw_corby_buffer_put_uint8( + sw_corby_buffer self, + sw_uint8 val); + + +sw_result HOWL_API +sw_corby_buffer_put_int16( + sw_corby_buffer self, + sw_int16 val); + + +sw_result HOWL_API +sw_corby_buffer_put_uint16( + sw_corby_buffer self, + sw_uint16 val); + + +sw_result HOWL_API +sw_corby_buffer_put_int32( + sw_corby_buffer self, + sw_int32 val); + + +sw_result HOWL_API +sw_corby_buffer_put_uint32( + sw_corby_buffer self, + sw_uint32 val); + + +sw_result HOWL_API +sw_corby_buffer_put_octets( + sw_corby_buffer self, + sw_const_octets val, + sw_size_t size); + + +sw_result HOWL_API +sw_corby_buffer_put_sized_octets( + sw_corby_buffer self, + sw_const_octets val, + sw_uint32 len); + + +sw_result HOWL_API +sw_corby_buffer_put_cstring( + sw_corby_buffer self, + sw_const_string val); + + +sw_result HOWL_API +sw_corby_buffer_put_object( + sw_corby_buffer self, + const struct _sw_corby_object * object); + + +sw_result HOWL_API +sw_corby_buffer_put_pad( + sw_corby_buffer self, + sw_corby_buffer_pad pad); + + +sw_result HOWL_API +sw_corby_buffer_get_int8( + sw_corby_buffer self, + sw_int8 * val); + + +sw_result HOWL_API +sw_corby_buffer_get_uint8( + sw_corby_buffer self, + sw_uint8 * val); + + +sw_result HOWL_API +sw_corby_buffer_get_int16( + sw_corby_buffer self, + sw_int16 * val, + sw_uint8 endian); + + +sw_result HOWL_API +sw_corby_buffer_get_uint16( + sw_corby_buffer self, + sw_uint16 * val, + sw_uint8 endian); + + +sw_result HOWL_API +sw_corby_buffer_get_int32( + sw_corby_buffer self, + sw_int32 * val, + sw_uint8 endian); + + +sw_result HOWL_API +sw_corby_buffer_get_uint32( + sw_corby_buffer self, + sw_uint32 * val, + sw_uint8 endian); + + +sw_result HOWL_API +sw_corby_buffer_get_octets( + sw_corby_buffer self, + sw_octets octets, + sw_size_t size); + + +sw_result HOWL_API +sw_corby_buffer_allocate_and_get_sized_octets( + sw_corby_buffer self, + sw_octets * val, + sw_uint32 * size, + sw_uint8 endian); + + +sw_result HOWL_API +sw_corby_buffer_get_zerocopy_sized_octets( + sw_corby_buffer self, + sw_octets * val, + sw_uint32 * size, + sw_uint8 endian); + + +sw_result HOWL_API +sw_corby_buffer_get_sized_octets( + sw_corby_buffer self, + sw_octets val, + sw_uint32 * len, + sw_uint8 endian); + + +sw_result HOWL_API +sw_corby_buffer_allocate_and_get_cstring( + sw_corby_buffer self, + sw_string * val, + sw_uint32 * len, + sw_uint8 endian); + + +sw_result HOWL_API +sw_corby_buffer_get_zerocopy_cstring( + sw_corby_buffer self, + sw_string * val, + sw_uint32 * len, + sw_uint8 endian); + + +sw_result HOWL_API +sw_corby_buffer_get_cstring( + sw_corby_buffer self, + sw_string val, + sw_uint32 * len, + sw_uint8 endian); + + +sw_result HOWL_API +sw_corby_buffer_get_object( + sw_corby_buffer self, + struct _sw_corby_object ** object, + sw_uint8 endian); + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/avahi-compat-howl/include/corby/channel.h b/avahi-compat-howl/include/corby/channel.h new file mode 100644 index 0000000..823e027 --- /dev/null +++ b/avahi-compat-howl/include/corby/channel.h @@ -0,0 +1,186 @@ +#ifndef _sw_corby_channel_h +#define _sw_corby_channel_h + +/* + * Copyright 2003, 2004 Porchdog Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of Porchdog Software. + */ + +#include +#include +#include +#include + + +#ifdef __cplusplus +extern "C" +{ +#endif + +struct _sw_corby_channel; +typedef struct _sw_corby_channel * sw_corby_channel; +struct _sw_corby_message; +struct _sw_corby_profile; +typedef struct _sw_corby_profile * sw_corby_profile; +typedef struct _sw_corby_profile const * sw_const_corby_profile; + + +typedef enum _sw_corby_reply_status +{ + SW_CORBY_NO_EXCEPTION = 0, + SW_CORBY_SYSTEM_EXCEPTION = 1, + SW_CORBY_USER_EXCEPTION = 2, + SW_CORBY_LOCATION_FORWARD = 3 +} sw_corby_reply_status; + + +typedef sw_result +(HOWL_API *sw_corby_channel_will_send_func)( + sw_corby_channel channel, + sw_octets bytes, + sw_size_t len, + sw_opaque_t extra); + + +typedef sw_result +(HOWL_API *sw_corby_channel_did_read_func)( + sw_corby_channel channel, + sw_octets bytes, + sw_size_t len, + sw_opaque_t extra); + + +typedef void +(HOWL_API *sw_corby_channel_cleanup_func)( + sw_corby_channel channel); + + +typedef struct _sw_corby_channel_delegate +{ + sw_opaque_t m_delegate; + sw_corby_channel_will_send_func m_will_send_func; + sw_corby_channel_did_read_func m_did_read_func; + sw_corby_channel_cleanup_func m_cleanup_func; + sw_opaque_t m_extra; +} * sw_corby_channel_delegate; + + +sw_result HOWL_API +sw_corby_channel_start_request( + sw_corby_channel self, + sw_const_corby_profile profile, + struct _sw_corby_buffer ** buffer, + sw_const_string op, + sw_uint32 oplen, + sw_bool reply_expected); + + +sw_result HOWL_API +sw_corby_channel_start_reply( + sw_corby_channel self, + struct _sw_corby_buffer ** buffer, + sw_uint32 request_id, + sw_corby_reply_status status); + + +sw_result HOWL_API +sw_corby_channel_send( + sw_corby_channel self, + struct _sw_corby_buffer * buffer, + sw_corby_buffer_observer observer, + sw_corby_buffer_written_func func, + sw_opaque_t extra); + + +sw_result HOWL_API +sw_corby_channel_recv( + sw_corby_channel self, + sw_salt * salt, + struct _sw_corby_message ** message, + sw_uint32 * request_id, + sw_string * op, + sw_uint32 * op_len, + struct _sw_corby_buffer ** buffer, + sw_uint8 * endian, + sw_bool block); + + +sw_result HOWL_API +sw_corby_channel_last_recv_from( + sw_corby_channel self, + sw_ipv4_address * from, + sw_port * from_port); + + +sw_result HOWL_API +sw_corby_channel_ff( + sw_corby_channel self, + struct _sw_corby_buffer * buffer); + + +sw_socket HOWL_API +sw_corby_channel_socket( + sw_corby_channel self); + + +sw_result HOWL_API +sw_corby_channel_retain( + sw_corby_channel self); + + +sw_result HOWL_API +sw_corby_channel_set_delegate( + sw_corby_channel self, + sw_corby_channel_delegate delegate); + + +sw_corby_channel_delegate HOWL_API +sw_corby_channel_get_delegate( + sw_corby_channel self); + + +void HOWL_API +sw_corby_channel_set_app_data( + sw_corby_channel self, + sw_opaque app_data); + + +sw_opaque HOWL_API +sw_corby_channel_get_app_data( + sw_corby_channel self); + + +sw_result HOWL_API +sw_corby_channel_fina( + sw_corby_channel self); + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/avahi-compat-howl/include/corby/corby.h b/avahi-compat-howl/include/corby/corby.h new file mode 100644 index 0000000..7d68138 --- /dev/null +++ b/avahi-compat-howl/include/corby/corby.h @@ -0,0 +1,68 @@ +#ifndef _corby_corby_h +#define _corby_corby_h + +/* + * Copyright 2003, 2004 Porchdog Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of Porchdog Software. + */ + +#include + +/* + * corby limits + */ +#define SW_CORBY_OID_LEN 32 + + +/* + * protocol tags. the only standard one is TAG_INTERNET_IIOP. + * the others are proprietary pandora corby protocols. + */ +#define SW_TAG_INTERNET_IOP 0 +#define SW_TAG_UIOP 250 +#define SW_TAG_MIOP 251 +#define SW_MIOP_ADDR "231.255.255.250" +typedef sw_uint32 sw_corby_protocol_tag; + + +/* + * error codes + */ +#define SW_E_CORBY_BASE 0x80000500 +#define SW_E_CORBY_UNKNOWN (SW_E_CORBY_BASE + 0) +#define SW_E_CORBY_BAD_CONFIG (SW_E_CORBY_BASE + 1) +#define SW_E_CORBY_NO_INTERFACE (SW_E_CORBY_BASE + 2) +#define SW_E_CORBY_BAD_URL (SW_E_CORBY_BASE + 3) +#define SW_E_CORBY_BAD_NAME (SW_E_CORBY_BASE + 4) +#define SW_E_CORBY_BAD_MESSAGE (SW_E_CORBY_BASE + 5) +#define SW_E_CORBY_BAD_VERSION (SW_E_CORBY_BASE + 6) +#define SW_E_CORBY_BAD_OID (SW_E_CORBY_BASE + 7) +#define SW_E_CORBY_BAD_OPERATION (SW_E_CORBY_BASE + 8) +#define SW_E_CORBY_MARSHAL (SW_E_CORBY_BASE + 10) +#define SW_E_CORBY_OBJECT_NOT_EXIST (SW_E_CORBY_BASE + 11) + + +#endif diff --git a/avahi-compat-howl/include/corby/message.h b/avahi-compat-howl/include/corby/message.h new file mode 100644 index 0000000..406b9b9 --- /dev/null +++ b/avahi-compat-howl/include/corby/message.h @@ -0,0 +1,60 @@ +#ifndef _sw_corby_message_h +#define _sw_corby_message_h + +/* + * Copyright 2003, 2004 Porchdog Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of Porchdog Software. + */ + +#include + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +struct _sw_corby_message; +typedef struct _sw_corby_message * sw_corby_message; + + +sw_result HOWL_API +sw_corby_message_init( + sw_corby_message * self); + + +sw_result HOWL_API +sw_corby_message_fina( + sw_corby_message self); + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/avahi-compat-howl/include/corby/object.h b/avahi-compat-howl/include/corby/object.h new file mode 100644 index 0000000..1bc7407 --- /dev/null +++ b/avahi-compat-howl/include/corby/object.h @@ -0,0 +1,113 @@ +#ifndef _corby_object_h +#define _corby_object_h + +/* + * Copyright 2003, 2004 Porchdog Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of Porchdog Software. + */ + +#include +#include +#include +#include +#include + +#if defined(__cplusplus) +extern "C" +{ +#endif + +struct _sw_corby_orb; +struct _sw_corby_object; +typedef struct _sw_corby_object * sw_corby_object; +typedef sw_opaque sw_corby_object_send_completion_handler; +typedef void +(HOWL_API *sw_corby_object_send_completion_func)( + sw_corby_object object, + sw_corby_buffer buffer, + sw_result result); + + + +sw_result HOWL_API +sw_corby_object_init_from_url( + sw_corby_object * self, + struct _sw_corby_orb * orb, + sw_const_string url, + sw_socket_options options, + sw_uint32 bufsize); + + +sw_result HOWL_API +sw_corby_object_fina( + sw_corby_object self); + + +sw_result HOWL_API +sw_corby_object_start_request( + sw_corby_object self, + sw_const_string op, + sw_uint32 op_len, + sw_bool reply_expected, + sw_corby_buffer * buffer); + + +sw_result HOWL_API +sw_corby_object_send( + sw_corby_object self, + sw_corby_buffer buffer, + sw_corby_buffer_observer observer, + sw_corby_buffer_written_func func, + sw_opaque extra); + + +sw_result HOWL_API +sw_corby_object_recv( + sw_corby_object self, + sw_corby_message * message, + sw_corby_buffer * buffer, + sw_uint8 * endian, + sw_bool block); + + +sw_result HOWL_API +sw_corby_object_channel( + sw_corby_object self, + sw_corby_channel * channel); + + +sw_result HOWL_API +sw_corby_object_set_channel( + sw_corby_object self, + sw_corby_channel channel); + + +#if defined(__cplusplus) +} +#endif + + +#endif diff --git a/avahi-compat-howl/include/corby/orb.h b/avahi-compat-howl/include/corby/orb.h new file mode 100644 index 0000000..a674082 --- /dev/null +++ b/avahi-compat-howl/include/corby/orb.h @@ -0,0 +1,199 @@ +#ifndef _corby_orb_h +#define _corby_orb_h + +/* + * Copyright 2003, 2004 Porchdog Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of Porchdog Software. + */ + +#include +#include +#include +#include + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +struct _sw_corby_orb; +typedef struct _sw_corby_orb * sw_corby_orb; +typedef sw_opaque sw_corby_orb_observer; +typedef sw_opaque sw_corby_servant; +struct _sw_corby_object; +struct _sw_corby_channel; +struct _sw_corby_message; +struct _sw_corby_buffer; + +typedef sw_result +(HOWL_API *sw_corby_orb_accept_channel_func)( + sw_corby_orb orb, + struct _sw_corby_channel * channel); + + +typedef struct _sw_corby_orb_delegate +{ + sw_opaque m_delegate; + sw_corby_orb_accept_channel_func m_accept_channel_func; + sw_opaque m_extra; +} * sw_corby_orb_delegate; + + +typedef struct _sw_corby_orb_config +{ + sw_string m_name; + sw_uint32 m_tag; + sw_string m_host; + sw_port m_port; + sw_string m_options; +} sw_corby_orb_config; + + +typedef sw_result +(HOWL_API *sw_corby_servant_cb)( + sw_corby_servant servant, + sw_salt salt, + sw_corby_orb orb, + struct _sw_corby_channel * channel, + struct _sw_corby_message * message, + struct _sw_corby_buffer * buffer, + sw_const_string op, + sw_uint32 op_len, + sw_uint32 request_id, + sw_uint8 endian); + + +typedef sw_result +(HOWL_API *sw_corby_orb_observer_func)( + sw_corby_orb_observer handler, + sw_salt salt, + sw_corby_orb orb, + struct _sw_corby_channel * channel, + sw_opaque_t extra); + + +sw_result HOWL_API +sw_corby_orb_init( + sw_corby_orb * self, + sw_salt salt, + const sw_corby_orb_config * config, + sw_corby_orb_observer observer, + sw_corby_orb_observer_func func, + sw_opaque_t extra); + + +sw_result HOWL_API +sw_corby_orb_fina( + sw_corby_orb self); + + +sw_result HOWL_API +sw_corby_orb_register_servant( + sw_corby_orb self, + sw_corby_servant servant, + sw_corby_servant_cb cb, + sw_const_string oid, + struct _sw_corby_object ** object, + sw_const_string protocol_name); + + +sw_result HOWL_API +sw_corby_orb_unregister_servant( + sw_corby_orb self, + sw_const_string oid); + + +sw_result HOWL_API +sw_corby_orb_register_bidirectional_object( + sw_corby_orb self, + struct _sw_corby_object * object); + + +sw_result HOWL_API +sw_corby_orb_register_channel( + sw_corby_orb self, + struct _sw_corby_channel * channel); + + +sw_corby_orb_delegate HOWL_API +sw_corby_orb_get_delegate( + sw_corby_orb self); + + +sw_result HOWL_API +sw_corby_orb_set_delegate( + sw_corby_orb self, + sw_corby_orb_delegate delegate); + + +sw_result HOWL_API +sw_corby_orb_set_observer( + sw_corby_orb self, + sw_corby_orb_observer observer, + sw_corby_orb_observer_func func, + sw_opaque_t extra); + + +sw_result HOWL_API +sw_corby_orb_protocol_to_address( + sw_corby_orb self, + sw_const_string tag, + sw_string addr, + sw_port * port); + + +sw_result HOWL_API +sw_corby_orb_protocol_to_url( + sw_corby_orb self, + sw_const_string tag, + sw_const_string name, + sw_string url, + sw_size_t url_len); + + +sw_result HOWL_API +sw_corby_orb_read_channel( + sw_corby_orb self, + struct _sw_corby_channel * channel); + + +sw_result HOWL_API +sw_corby_orb_dispatch_message( + sw_corby_orb self, + struct _sw_corby_channel * channel, + struct _sw_corby_message * message, + struct _sw_corby_buffer * buffer, + sw_uint8 endian); + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/avahi-compat-howl/include/discovery/discovery.h b/avahi-compat-howl/include/discovery/discovery.h new file mode 100644 index 0000000..1e8a7d5 --- /dev/null +++ b/avahi-compat-howl/include/discovery/discovery.h @@ -0,0 +1,327 @@ +#ifndef _discovery_discovery_h +#define _discovery_discovery_h + +/* + * Copyright 2003, 2004 Porchdog Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of Porchdog Software. + */ + +#include +#include + + +#if defined(__cplusplus) +extern "C" +{ +#endif + + +struct _sw_discovery; +typedef struct _sw_discovery * sw_discovery; + + +/* + * keeps track of different discovery operations + */ +typedef sw_uint32 sw_discovery_oid; + + +/* + * For backwards compatibility + */ +#define sw_discovery_publish_host_id sw_discovery_oid +#define sw_discovery_publish_id sw_discovery_oid +#define sw_discovery_browse_id sw_discovery_oid +#define sw_discovery_resolve_id sw_discovery_oid + + +/* + * how to connect to server + */ +typedef enum _sw_discovery_init_flags +{ + SW_DISCOVERY_USE_SHARED_SERVICE = 0x1, + SW_DISCOVERY_USE_PRIVATE_SERVICE = 0x2, + SW_DISCOVERY_SKIP_VERSION_CHECK = 0x4 +} sw_discovery_init_flags; + + +/* + * status for asynchronous registration call + */ +typedef enum _sw_discovery_publish_status +{ + SW_DISCOVERY_PUBLISH_STARTED, + SW_DISCOVERY_PUBLISH_STOPPED, + SW_DISCOVERY_PUBLISH_NAME_COLLISION, + SW_DISCOVERY_PUBLISH_INVALID +} sw_discovery_publish_status; + + +typedef enum _sw_discovery_browse_status +{ + SW_DISCOVERY_BROWSE_INVALID, + SW_DISCOVERY_BROWSE_RELEASE, + SW_DISCOVERY_BROWSE_ADD_DOMAIN, + SW_DISCOVERY_BROWSE_ADD_DEFAULT_DOMAIN, + SW_DISCOVERY_BROWSE_REMOVE_DOMAIN, + SW_DISCOVERY_BROWSE_ADD_SERVICE, + SW_DISCOVERY_BROWSE_REMOVE_SERVICE, + SW_DISCOVERY_BROWSE_RESOLVED +} sw_discovery_browse_status; + + +typedef enum _sw_discovery_query_record_status +{ + SW_DISCOVERY_QUERY_RECORD_ADD = 0x1 +} sw_discovery_query_record_status; + + +typedef sw_result +(HOWL_API *sw_discovery_publish_reply)( + sw_discovery session, + sw_discovery_oid oid, + sw_discovery_publish_status status, + sw_opaque extra); + +typedef sw_result +(HOWL_API *sw_discovery_browse_reply)( + sw_discovery session, + sw_discovery_oid oid, + sw_discovery_browse_status status, + sw_uint32 interface_index, + sw_const_string name, + sw_const_string type, + sw_const_string domain, + sw_opaque extra); + +typedef sw_result +(HOWL_API *sw_discovery_resolve_reply)( + sw_discovery session, + sw_discovery_oid oid, + sw_uint32 interface_index, + sw_const_string name, + sw_const_string type, + sw_const_string domain, + sw_ipv4_address address, + sw_port port, + sw_octets text_record, + sw_uint32 text_record_len, + sw_opaque extra); + + +typedef sw_result +(HOWL_API *sw_discovery_query_record_reply)( + sw_discovery session, + sw_discovery_oid oid, + sw_discovery_query_record_status status, + sw_uint32 interface_index, + sw_const_string fullname, + sw_uint16 rrtype, + sw_uint16 rrclass, + sw_uint16 rrdatalen, + sw_const_octets rrdata, + sw_uint32 ttl, + sw_opaque extra); + + +/* + * API for publishing/browsing/resolving services + */ +sw_result HOWL_API +sw_discovery_init( + sw_discovery * self); + + +sw_result HOWL_API +sw_discovery_init_with_flags( + sw_discovery * self, + sw_discovery_init_flags flags); + + +sw_result HOWL_API +sw_discovery_fina( + sw_discovery self); + + +sw_result HOWL_API +sw_discovery_publish_host( + sw_discovery self, + sw_uint32 interface_index, + sw_const_string name, + sw_const_string domain, + sw_ipv4_address address, + sw_discovery_publish_reply reply, + sw_opaque extra, + sw_discovery_oid * oid); + + +sw_result HOWL_API +sw_discovery_publish( + sw_discovery self, + sw_uint32 interface_index, + sw_const_string name, + sw_const_string type, + sw_const_string domain, + sw_const_string host, + sw_port port, + sw_octets text_record, + sw_uint32 text_record_len, + sw_discovery_publish_reply reply, + sw_opaque extra, + sw_discovery_oid * oid); + + +sw_result HOWL_API +sw_discovery_publish_update( + sw_discovery self, + sw_discovery_oid oid, + sw_octets text_record, + sw_uint32 text_record_len); + + + +/* + * API for browsing domains + */ +sw_result HOWL_API +sw_discovery_browse_domains( + sw_discovery self, + sw_uint32 interface_index, + sw_discovery_browse_reply reply, + sw_opaque extra, + sw_discovery_oid * oid); + + + +/* + * API for browsing services + */ +sw_result HOWL_API +sw_discovery_browse( + sw_discovery self, + sw_uint32 interface_index, + sw_const_string type, + sw_const_string domain, + sw_discovery_browse_reply reply, + sw_opaque extra, + sw_discovery_oid * oid); + + +/* + * API for resolving services + */ +sw_result HOWL_API +sw_discovery_resolve( + sw_discovery self, + sw_uint32 interface_index, + sw_const_string name, + sw_const_string type, + sw_const_string domain, + sw_discovery_resolve_reply reply, + sw_opaque extra, + sw_discovery_oid * oid); + + +sw_result HOWL_API +sw_discovery_query_record( + sw_discovery self, + sw_uint32 interface_index, + sw_uint32 flags, + sw_const_string fullname, + sw_uint16 rrtype, + sw_uint16 rrclass, + sw_discovery_query_record_reply reply, + sw_opaque extra, + sw_discovery_oid * oid); + + +sw_result HOWL_API +sw_discovery_cancel( + sw_discovery self, + sw_discovery_oid oid); + + + +/* ---------------------------------------------------------- + * + * Event Processing APIs + * + * ---------------------------------------------------------- + */ + + +sw_result HOWL_API +sw_discovery_run( + sw_discovery self); + + +sw_result HOWL_API +sw_discovery_stop_run( + sw_discovery self); + + +int HOWL_API +sw_discovery_socket( + sw_discovery self); + + +sw_result HOWL_API +sw_discovery_read_socket( + sw_discovery self); + + +sw_result HOWL_API +sw_discovery_salt( + sw_discovery self, + sw_salt * salt); + + +/* + * Error codes + */ +#define SW_DISCOVERY_E_BASE 900 +#define SW_DISCOVERY_E_UNKNOWN (SW_DISCOVERY_E_BASE + 2) +#define SW_DISCOVERY_E_NO_SUCH_NAME (SW_DISCOVERY_E_BASE + 3) +#define SW_DISCOVERY_E_NO_MEM (SW_DISCOVERY_E_BASE + 4) +#define SW_DISCOVERY_E_BAD_PARAM (SW_DISCOVERY_E_BASE + 5) +#define SW_DISCOVERY_E_BAD_REFERENCE (SW_DISCOVERY_E_BASE + 6) +#define SW_DISCOVERY_E_BAD_STATE (SW_DISCOVERY_E_BASE + 7) +#define SW_DISCOVERY_E_BAD_FLAGS (SW_DISCOVERY_E_BASE + 8) +#define SW_DISCOVERY_E_NOT_SUPPORTED (SW_DISCOVERY_E_BASE + 9) +#define SW_DISCOVERY_E_NOT_INITIALIZED (SW_DISCOVERY_E_BASE + 10) +#define SW_DISCOVERY_E_NO_CACHE (SW_DISCOVERY_E_BASE + 11) +#define SW_DISCOVERY_E_ALREADY_REGISTERED (SW_DISCOVERY_E_BASE + 12) +#define SW_DISCOVERY_E_NAME_CONFLICT (SW_DISCOVERY_E_BASE + 13) +#define SW_DISCOVERY_E_INVALID (SW_DISCOVERY_E_BASE + 14) + + +#if defined(__cplusplus) +} +#endif + + +#endif diff --git a/avahi-compat-howl/include/discovery/text_record.h b/avahi-compat-howl/include/discovery/text_record.h new file mode 100644 index 0000000..91f16d7 --- /dev/null +++ b/avahi-compat-howl/include/discovery/text_record.h @@ -0,0 +1,143 @@ +#ifndef _discovery_text_record_h +#define _discovery_text_record_h + +/* + * Copyright 2003, 2004 Porchdog Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of Porchdog Software. + */ + +#include + +#if defined(__cplusplus) +extern "C" +{ +#endif + +#define SW_TEXT_RECORD_MAX_LEN 255 + + +struct _sw_text_record; +typedef struct _sw_text_record * sw_text_record; +struct _sw_text_record_iterator; +typedef struct _sw_text_record_iterator * sw_text_record_iterator; +struct _sw_text_record_string_iterator; +typedef struct _sw_text_record_string_iterator * sw_text_record_string_iterator; + + +/* + * Text record APIs + */ +sw_result HOWL_API +sw_text_record_init( + sw_text_record * self); + + +sw_result HOWL_API +sw_text_record_fina( + sw_text_record self); + + +sw_result HOWL_API +sw_text_record_add_string( + sw_text_record self, + sw_const_string string); + + +sw_result HOWL_API +sw_text_record_add_key_and_string_value( + sw_text_record self, + sw_const_string key, + sw_const_string val); + + +sw_result HOWL_API +sw_text_record_add_key_and_binary_value( + sw_text_record self, + sw_const_string key, + sw_octets val, + sw_uint32 len); + + +sw_octets HOWL_API +sw_text_record_bytes( + sw_text_record self); + + +sw_uint32 HOWL_API +sw_text_record_len( + sw_text_record self); + + +/* + * APIs for iterating through raw text records + */ +sw_result HOWL_API +sw_text_record_iterator_init( + sw_text_record_iterator * self, + sw_octets text_record, + sw_uint32 text_record_len); + + +sw_result HOWL_API +sw_text_record_iterator_fina( + sw_text_record_iterator self); + + +sw_result HOWL_API +sw_text_record_iterator_next( + sw_text_record_iterator self, + char key[SW_TEXT_RECORD_MAX_LEN], + sw_uint8 val[SW_TEXT_RECORD_MAX_LEN], + sw_uint32 * val_len); + + +/* + * APIs for iterating through stringified text records + */ +sw_result HOWL_API +sw_text_record_string_iterator_init( + sw_text_record_string_iterator * self, + sw_const_string text_record_string); + + +sw_result HOWL_API +sw_text_record_string_iterator_fina( + sw_text_record_string_iterator self); + + +sw_result HOWL_API +sw_text_record_string_iterator_next( + sw_text_record_string_iterator self, + char key[SW_TEXT_RECORD_MAX_LEN], + char val[SW_TEXT_RECORD_MAX_LEN]); + + +#if defined(__cplusplus) +} +#endif + + +#endif diff --git a/avahi-compat-howl/include/howl.h b/avahi-compat-howl/include/howl.h new file mode 100644 index 0000000..80a1775 --- /dev/null +++ b/avahi-compat-howl/include/howl.h @@ -0,0 +1,44 @@ +#ifndef _sw_howl_h +#define _sw_howl_h + +/* + * Copyright 2003, 2004 Porchdog Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of Porchdog Software. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#endif diff --git a/avahi-compat-howl/include/rendezvous/rendezvous.h b/avahi-compat-howl/include/rendezvous/rendezvous.h new file mode 100644 index 0000000..1d26b4a --- /dev/null +++ b/avahi-compat-howl/include/rendezvous/rendezvous.h @@ -0,0 +1,101 @@ +#ifndef _rendezvous_rendezvous_h +#define _rendezvous_rendezvous_h + +/* + * Copyright 2003, 2004 Porchdog Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of Porchdog Software. + */ + +#include + +#define _sw_rendezvous _sw_discovery +#define sw_rendezvous sw_discovery +#define sw_rendezvous_publish_domain_id sw_discovery_publish_domain_id +#define sw_rendezvous_publish_host_id sw_discovery_publish_host_id +#define sw_rendezvous_publish_id sw_discovery_publish_id +#define sw_rendezvous_browse_id sw_discovery_browse_id +#define sw_rendezvous_resolve_id sw_discovery_resolve_id +#define sw_rendezvous_publish_status sw_discovery_publish_status +#define SW_RENDEZVOUS_PUBLISH_STARTED SW_DISCOVERY_PUBLISH_STARTED +#define SW_RENDEZVOUS_PUBLISH_STOPPED SW_DISCOVERY_PUBLISH_STOPPED +#define SW_RENDEZVOUS_PUBLISH_NAME_COLLISION SW_DISCOVERY_PUBLISH_NAME_COLLISION +#define SW_RENDEZVOUS_PUBLISH_INVALID SW_DISCOVERY_PUBLISH_INVALID +#define sw_rendezvous_browse_status sw_discovery_browse_status +#define SW_RENDEZVOUS_BROWSE_INVALID SW_DISCOVERY_BROWSE_INVALID +#define SW_RENDEZVOUS_BROWSE_RELEASE SW_DISCOVERY_BROWSE_RELEASE +#define SW_RENDEZVOUS_BROWSE_ADD_DOMAIN SW_DISCOVERY_BROWSE_ADD_DOMAIN +#define SW_RENDEZVOUS_BROWSE_ADD_DEFAULT_DOMAIN SW_DISCOVERY_BROWSE_ADD_DEFAULT_DOMAIN +#define SW_RENDEZVOUS_BROWSE_REMOVE_DOMAIN SW_DISCOVERY_BROWSE_REMOVE_DOMAIN +#define SW_RENDEZVOUS_BROWSE_ADD_SERVICE SW_DISCOVERY_BROWSE_ADD_SERVICE +#define SW_RENDEZVOUS_BROWSE_REMOVE_SERVICE SW_DISCOVERY_BROWSE_REMOVE_SERVICE +#define SW_RENDEZVOUS_BROWSE_RESOLVED SW_DISCOVERY_BROWSE_RESOLVED +#define sw_rendezvous_publish_domain_handler sw_discovery_publish_domain_handler +#define sw_rendezvous_publish_domain_reply sw_discovery_publish_domain_reply +#define sw_rendezvous_publish_host_handler sw_discovery_publish_host_handler +#define sw_rendezvous_publish_host_reply sw_discovery_publish_host_reply +#define sw_rendezvous_publish_handler sw_discovery_publish_handler +#define sw_rendezvous_publish_reply sw_discovery_publish_reply +#define sw_rendezvous_browse_handler sw_discovery_browse_handler +#define sw_rendezvous_browse_reply sw_discovery_browse_reply +#define sw_rendezvous_resolve_handler sw_discovery_resolve_handler +#define sw_rendezvous_resolve_reply sw_discovery_resolve_reply +#define sw_rendezvous_init sw_discovery_init +#define sw_rendezvous_fina sw_discovery_fina +#define sw_rendezvous_publish_domain sw_discovery_publish_domain +#define sw_rendezvous_stop_publish_domain sw_discovery_stop_publish_domain +#define sw_rendezvous_publish_host sw_discovery_publish_host +#define sw_rendezvous_stop_publish_host sw_discovery_stop_publish_host +#define sw_rendezvous_publish sw_discovery_publish +#define sw_rendezvous_publish_update sw_discovery_publish_update +#define sw_rendezvous_stop_publish sw_discovery_stop_publish +#define sw_rendezvous_browse_domains sw_discovery_browse_domains +#define sw_rendezvous_stop_browse_domains sw_discovery_stop_browse_domains +#define sw_rendezvous_browse_services sw_discovery_browse +#define sw_rendezvous_stop_browse_services sw_discovery_stop_browse +#define sw_rendezvous_resolve sw_discovery_resolve +#define sw_rendezvous_stop_resolve sw_discovery_stop_resolve +#define sw_rendezvous_run sw_discovery_run +#define sw_rendezvous_stop_run sw_discovery_stop_run +#define sw_rendezvous_socket sw_discovery_socket +#define sw_rendezvous_read_socket sw_discovery_read_socket +#define sw_rendezvous_salt sw_discovery_salt +#define SW_RENDEZVOUS_E_BASE SW_DISCOVERY_E_BASE +#define SW_RENDEZVOUS_E_UNKNOWN SW_DISCOVERY_E_UNKNOWN +#define SW_RENDEZVOUS_E_NO_SUCH_NAME SW_DISCOVERY_E_NO_SUCH_NAME +#define SW_RENDEZVOUS_E_NO_MEM SW_DISCOVERY_E_NO_MEM +#define SW_RENDEZVOUS_E_BAD_PARAM SW_DISCOVERY_E_BAD_PARAM +#define SW_RENDEZVOUS_E_BAD_REFERENCE SW_DISCOVERY_E_BAD_REFERENCE +#define SW_RENDEZVOUS_E_BAD_STATE SW_DISCOVERY_E_BAD_STATE +#define SW_RENDEZVOUS_E_BAD_FLAGS SW_DISCOVERY_E_BAD_FLAGS +#define SW_RENDEZVOUS_E_NOT_SUPPORTED SW_DISCOVERY_E_NOT_SUPPORTED +#define SW_RENDEZVOUS_E_NOT_INITIALIZED SW_DISCOVERY_E_NOT_INITIALIZED +#define SW_RENDEZVOUS_E_NO_CACHE SW_DISCOVERY_E_NO_CACHE +#define SW_RENDEZVOUS_E_ALREADY_REGISTERED SW_DISCOVERY_E_ALREADY_REGISTERED +#define SW_RENDEZVOUS_E_NAME_CONFLICT SW_DISCOVERY_E_NAME_CONFLICT +#define SW_RENDEZVOUS_E_INVALID SW_DISCOVERY_E_INVALID + + +#endif diff --git a/avahi-compat-howl/include/rendezvous/text_record.h b/avahi-compat-howl/include/rendezvous/text_record.h new file mode 100644 index 0000000..cf8b845 --- /dev/null +++ b/avahi-compat-howl/include/rendezvous/text_record.h @@ -0,0 +1,36 @@ +#ifndef _rendezvous_text_record_h +#define _rendezvous_text_record_h + +/* + * Copyright 2003, 2004 Porchdog Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of Porchdog Software. + */ + + +#include + + +#endif diff --git a/avahi-compat-howl/include/salt/address.h b/avahi-compat-howl/include/salt/address.h new file mode 100644 index 0000000..b18a4af --- /dev/null +++ b/avahi-compat-howl/include/salt/address.h @@ -0,0 +1,128 @@ +#ifndef _salt_address_h +#define _salt_address_h + +/* + * Copyright 2003, 2004 Porchdog Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of Porchdog Software. + */ + + +#include + + +#if defined(__cplusplus) +extern "C" +{ +#endif + + +typedef struct _sw_ipv4_address +{ + sw_uint32 m_addr; +} sw_ipv4_address; + +typedef sw_uint32 sw_saddr; + + +sw_ipv4_address HOWL_API +sw_ipv4_address_any(void); + + +sw_ipv4_address HOWL_API +sw_ipv4_address_loopback(void); + + +sw_result HOWL_API +sw_ipv4_address_init( + sw_ipv4_address * self); + + +sw_result HOWL_API +sw_ipv4_address_init_from_saddr( + sw_ipv4_address * self, + sw_saddr saddr); + + +sw_result HOWL_API +sw_ipv4_address_init_from_name( + sw_ipv4_address * self, + sw_const_string name); + + +sw_result HOWL_API +sw_ipv4_address_init_from_address( + sw_ipv4_address * self, + sw_ipv4_address addr); + + +sw_result HOWL_API +sw_ipv4_address_init_from_this_host( + sw_ipv4_address * self); + + +sw_result HOWL_API +sw_ipv4_address_fina( + sw_ipv4_address self); + + +sw_bool HOWL_API +sw_ipv4_address_is_any( + sw_ipv4_address self); + + +sw_saddr HOWL_API +sw_ipv4_address_saddr( + sw_ipv4_address self); + + +sw_string HOWL_API +sw_ipv4_address_name( + sw_ipv4_address self, + sw_string name, + sw_uint32 len); + + +sw_result HOWL_API +sw_ipv4_address_decompose( + sw_ipv4_address self, + sw_uint8 * a1, + sw_uint8 * a2, + sw_uint8 * a3, + sw_uint8 * a4); + + +sw_bool HOWL_API +sw_ipv4_address_equals( + sw_ipv4_address self, + sw_ipv4_address addr); + + +#if defined(__cplusplus) +} +#endif + + +#endif diff --git a/avahi-compat-howl/include/salt/debug.h b/avahi-compat-howl/include/salt/debug.h new file mode 100644 index 0000000..03bd453 --- /dev/null +++ b/avahi-compat-howl/include/salt/debug.h @@ -0,0 +1,230 @@ +#ifndef _salt_debug_h +#define _salt_debug_h + +/* + * Copyright 2003, 2004 Porchdog Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of Porchdog Software. + */ + +#include +#include + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +#define SW_LOG_WARNING 1 << 0 +#define SW_LOG_ERROR 1 << 1 +#define SW_LOG_NOTICE 1 << 2 +#define SW_LOG_VERBOSE 1 << 3 +#define SW_LOG_OFF 0x0 + + +#if (defined( __GNUC__)) + +# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) + +# define __C99_VA_ARGS__ 1 + +# define __GNU_VA_ARGS__ 0 + +# else + +# define __C99_VA_ARGS__ 0 + +# define __GNU_VA_ARGS__ 1 + +# endif + +#else + +# define __C99_VA_ARGS__ 0 + +# define __GNU_VA_ARGS__ 0 + +#endif + + +# if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 9))) + +# define __SW_FUNCTION__ __func__ + +#elif (defined( __GNUC__)) + +# define __SW_FUNCTION__ __PRETTY_FUNCTION__ + +#elif( defined(_MSC_VER ) && !defined(_WIN32_WCE)) + +# define __SW_FUNCTION__ __FUNCTION__ + +#else + +# define __SW_FUNCTION__ "" + +#endif + + +#define sw_check(expr, label, action) \ +do \ +{ \ + if (!(expr)) \ + { \ + { \ + action; \ + } \ + goto label; \ + } \ +} while (0) + + +#define sw_check_log(expr, label, action) \ +do \ +{ \ + if (!(expr)) \ + { \ + sw_print_assert(0, NULL, __FILE__, __SW_FUNCTION__, __LINE__); \ + { \ + action; \ + } \ + goto label; \ + } \ +} while (0) + + +#define sw_check_okay(code, label) \ +do \ +{ \ + if ((int) code != 0) \ + { \ + goto label; \ + } \ +} while (0) + + +#define sw_check_okay_log(code, label) \ +do \ +{ \ + if ((int) code != 0) \ + { \ + sw_print_assert((int) code, NULL, __FILE__, __SW_FUNCTION__, __LINE__); \ + goto label; \ + } \ +} while ( 0 ) + + +#define sw_translate_error(expr, errno) ((expr) ? 0 : (errno)) + + +#if defined(WIN32) + +# define sw_socket_errno() (int) WSAGetLastError() +# define sw_set_socket_errno(X) WSASetLastError(X) +# define sw_system_errno() (int) GetLastError() +# define sw_set_system_errno(X) SetLastError(X) + +#else + +# define sw_socket_errno() errno +# define sw_set_socket_errno(X) errno = X +# define sw_system_errno() errno +# define sw_set_system_errno(X) errno = X + +#endif + + +#if !defined(NDEBUG) + +# define sw_assert(X) \ + \ + do \ + { \ + if (!(X)) \ + { \ + sw_print_assert( 0, #X, __FILE__, __SW_FUNCTION__, __LINE__); \ + } \ + } while( 0 ) + +#else + +# define sw_assert(X) + +#endif + + +void HOWL_API +sw_print_assert( + int code, + sw_const_string assert_string, + sw_const_string file, + sw_const_string func, + int line); + + +#if !defined(NDEBUG) + +void HOWL_API +sw_print_debug( + int level, + sw_const_string format, + ...); + +# if (__C99_VA_ARGS__) + +# define sw_debug(...) sw_print_debug(__VA_ARGS__) + +# else + +# define sw_debug sw_print_debug + +# endif + +#else + +# if (__C99_VA_ARGS__) + +# define sw_debug(...) + +# else + +# define sw_debug while( 0 ) + +# endif + +#endif + + +#define SW_UNUSED_PARAM(X) (void) (X) + + +#if defined(__cplusplus) +} +#endif + + +#endif diff --git a/avahi-compat-howl/include/salt/interface.h b/avahi-compat-howl/include/salt/interface.h new file mode 100644 index 0000000..5356398 --- /dev/null +++ b/avahi-compat-howl/include/salt/interface.h @@ -0,0 +1,115 @@ +#ifndef _sw_interface_h +#define _sw_interface_h + +/* + * Copyright 2003, 2004 Porchdog Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of Porchdog Software. + */ + +#include + +struct _sw_network_interface; +typedef struct _sw_network_interface * sw_network_interface; + + +typedef enum _sw_network_interface_state +{ + SW_NETWORK_INTERFACE_RUNNING = 0x1, +} sw_network_interface_state; + + +typedef struct _sw_mac_address +{ + sw_uint8 m_id[6]; +} sw_mac_address; + + +sw_result HOWL_API +sw_network_interfaces( + sw_uint32 * count, + sw_network_interface ** netifs); + + +sw_result HOWL_API +sw_network_interfaces_fina( + sw_uint32 count, + sw_network_interface * netifs); + + +sw_result HOWL_API +sw_network_interface_fina( + sw_network_interface netif); + + +sw_result HOWL_API +sw_network_interface_by_name( + sw_string name, + sw_network_interface * netif); + + +sw_result HOWL_API +sw_network_interface_name( + sw_network_interface netif, + sw_string name, + sw_uint32 len); + + +sw_result HOWL_API +sw_network_interface_mac_address( + sw_network_interface netif, + sw_mac_address * addr); + + +sw_result HOWL_API +sw_network_interface_ipv4_address( + sw_network_interface netif, + sw_ipv4_address * addr); + + +sw_result HOWL_API +sw_network_interface_set_ipv4_address( + sw_network_interface netif, + sw_ipv4_address addr); + + +sw_result HOWL_API +sw_network_interface_index( + sw_network_interface netif, + sw_uint32 * index); + + +sw_result HOWL_API +sw_network_interface_linked( + sw_network_interface netif, + sw_bool * linked); + + +sw_result HOWL_API +sw_network_interface_up( + sw_network_interface netif); + + +#endif diff --git a/avahi-compat-howl/include/salt/platform.h b/avahi-compat-howl/include/salt/platform.h new file mode 100644 index 0000000..d0553e7 --- /dev/null +++ b/avahi-compat-howl/include/salt/platform.h @@ -0,0 +1,438 @@ +#ifndef _sw_platform_h +#define _sw_platform_h + +/* + * Copyright 2003, 2004 Porchdog Software, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of Porchdog Software, Inc. + */ + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +#if defined(__VXWORKS__) + +# define HOWL_API +# include +# include + +# define sw_snooze(SECS) taskDelay(sysClkRateGet() * SECS) + +#elif defined(WIN32) + +# define WIN32_LEAN_AND_MEAN +# define HOWL_API __stdcall +# pragma warning(disable:4127) +# include +# include + +typedef signed char int8_t; +typedef unsigned char u_int8_t; +typedef signed short int16_t; +typedef unsigned short u_int16_t; +typedef signed long int32_t; +typedef unsigned long u_int32_t; +typedef _int64 int64_t; +typedef _int64 u_int64_t; + +# define sw_snooze(SECS) Sleep(SECS * 1000) + +#else + +# define HOWL_API +# if defined(HOWL_KERNEL) +# include +# endif +# include +# include +# include + +# define sw_snooze(SECS) sleep(SECS) + +#endif + +#if defined(__sun) + +# define u_int8_t uint8_t +# define u_int16_t uint16_t +# define u_int32_t uint32_t +# define u_int64_t uint64_t + +#endif + +typedef void * sw_opaque; +typedef void * sw_opaque_t; +typedef int8_t sw_int8; +typedef u_int8_t sw_uint8; +typedef u_int8_t sw_bool; +typedef int16_t sw_int16; +typedef u_int16_t sw_uint16; +typedef int32_t sw_int32; +typedef u_int32_t sw_uint32; +typedef int64_t sw_int64; +typedef u_int64_t sw_uint64; +typedef char * sw_string; +typedef sw_uint8 * sw_octets; +#if !defined(__VXWORKS__) || defined(__cplusplus) +typedef const char * sw_const_string; +typedef const u_int8_t * sw_const_octets; +#else +typedef char * sw_const_string; +typedef u_int8_t * sw_const_octets; +#endif +typedef size_t sw_size_t; +typedef int sw_result; + + + +/* -------------------------------------------------------- + * + * Endian-osity + * + * SW_ENDIAN is 0 for big endian platforms, 1 + * for little endian platforms. + * + * The macro WORDS_BIGENDIAN will be defined + * by autoconf. If you are using Howl on + * a platform that doesn't have autoconf, define + * SW_ENDIAN directly + * -------------------------------------------------------- + */ + +#if !defined(SW_ENDIAN) + +# if WORDS_BIGENDIAN == 1 + +# define SW_ENDIAN 0 + +# else + +# define SW_ENDIAN 1 + +# endif + +#endif + + +/* -------------------------------------------------------- + * + * Strings + * + * These macros supports cross platform string functions + * for the following OSes + * + * Win32 + * *NIX + * PalmOS + * VxWorks + * + * -------------------------------------------------------- + */ + +#if defined(WIN32) + +# include + +# define sw_memset(ARG1, ARG2, ARG3) memset((char*) ARG1, ARG2, ARG3) +# define sw_memcpy(ARG1, ARG2, ARG3) memmove((char*) ARG1, (char*) ARG2, ARG3) +# define sw_memcmp(ARG1, ARG2, ARG3) memcmp((char*) ARG1, ARG2, ARG3) +# define sw_strcasecmp(ARG1, ARG2) stricmp(ARG1, ARG2) +# define sw_strncasecmp(ARG1, ARG2) strnicmp(ARG1, ARG2) +# define sw_strcat(ARG1, ARG2) strcat(ARG1, ARG2) +# define sw_strncat(ARG1, ARG2) strncat(ARG1, ARG2) +# define sw_strchr(ARG1, ARG2) strchr(ARG1, ARG2) +# define sw_strcmp(ARG1, ARG2) strcmp(ARG1, ARG2) +# define sw_strncmp(ARG1, ARG2) strncmp(ARG1, ARG2) +# define sw_strcoll(ARG1, ARG2) strcoll(ARG1, ARG2) +# define sw_strcpy(ARG1, ARG2) (ARG2) ? strcpy(ARG1, ARG2) : strcpy(ARG1, "") +# define sw_strncpy(ARG1, ARG2, N) (ARG2) ? strncpy(ARG1, ARG2, N) : strcpy(ARG1, "") +# define sw_strcspn(ARG1, ARG2) strcspn(ARG1, ARG2) +# define sw_strlen(ARG1) strlen(ARG1) +# define sw_strstr(ARG1, ARG2) strstr(ARG1, ARG2) +# define sw_strtok_r(ARG1, ARG2, ARG3) strtok_r(ARG1, ARG2, ARG3) + +#elif defined(__VXWORKS__) + +# include + +extern sw_int32 +sw_strcasecmp( + sw_const_string arg1, + sw_const_string arg2); + +extern sw_int32 +sw_strncasecmp( + sw_const_string arg1, + sw_const_string arg2, + sw_len n); + +extern sw_string +sw_strtok_r( + sw_string arg1, + sw_const_string arg2, + sw_string * lasts); + +# define sw_memset(ARG1, ARG2, ARG3) memset((char*) ARG1, ARG2, ARG3) +# define sw_memcpy(ARG1, ARG2, ARG3) memcpy((char*) ARG1, (char*) ARG2, ARG3) +# define sw_memcmp(ARG1, ARG2, ARG3) memcmp((char*) ARG1, ARG2, ARG3) +# define sw_strcat(ARG1, ARG2) strcat(ARG1, ARG2) +# define sw_strncat(ARG1, ARG2) strncat(ARG1, ARG2) +# define sw_strchr(ARG1, ARG2) strchr(ARG1, ARG2) +# define sw_strcmp(ARG1, ARG2) strcmp(ARG1, ARG2) +# define sw_strncmp(ARG1, ARG2) strncmp(ARG1, ARG2) +# define sw_strcoll(ARG1, ARG2) strcoll(ARG1, ARG2) +# define sw_strcpy(ARG1, ARG2) ARG2 ? strcpy(ARG1, ARG2) : strcpy(ARG1, "") +# define sw_strncpy(ARG1, ARG2, N) ARG2 ? strncpy(ARG1, ARG2, N) : strcpy(ARG1, "") +# define sw_strcspn(ARG1, ARG2) strcspn(ARG1, ARG2) +# define sw_strlen(ARG1) strlen(ARG1) +# define sw_strstr(ARG1, ARG2) strstr(ARG1, ARG2) + +#elif defined(__PALMOS__) + +# include + +# define sw_strcasecmp(ARG1, ARG2) strcasecmp(ARG1, ARG2) +# define sw_strncasecmp(ARG1, ARG2) strncasecmp(ARG1, ARG2) +# define sw_strcat(ARG1, ARG2) StrCat(ARG1, ARG2) +# define sw_strncat(ARG1, ARG2) StrNCat(ARG1, ARG2) +# define sw_strchr(ARG1, ARG2) StrChr(ARG1, ARG2) +# define sw_strcmp(ARG1, ARG2) StrCampare(ARG1, ARG2) +# define sw_strncmp(ARG1, ARG2) StrNCompare(ARG1, ARG2) +# define sw_strcoll(ARG1, ARG2) strcoll(ARG1, ARG2) +# define sw_strcpy(ARG1, ARG2) ARG2 ? StrCopy(ARG1, ARG2) : StrCopy(ARG1, "") +# define sw_strncpy(ARG1, ARG2, N) ARG2 ? StrNCopy(ARG1, ARG2, N) : StrCopy(ARG1, "") +# define sw_strcspn(ARG1, ARG2) strcspn(ARG1, ARG2) +# define sw_strlen(ARG1) StrLen(ARG1) +# define sw_strstr(ARG1, ARG2) strstr(ARG1, ARG2) +# define sw_strtok_r(ARG1, ARG2, ARG3) strtok_r(ARG1, ARG2, ARG3) + +#else + +# include + +# if defined(__Lynx__) + char * strchr(char*, int); +# endif + +# define sw_memset(ARG1, ARG2, ARG3) memset((char*) ARG1, ARG2, ARG3) +# define sw_memcpy(ARG1, ARG2, ARG3) memcpy((char*) ARG1, (char*) ARG2, ARG3) +# define sw_memcmp(ARG1, ARG2, ARG3) memcmp((char*) ARG1, ARG2, ARG3) +# define sw_strcasecmp(ARG1, ARG2) strcasecmp(ARG1, ARG2) +# define sw_strncasecmp(ARG1, ARG2) strncasecmp(ARG1, ARG2) +# define sw_strcat(ARG1, ARG2) strcat(ARG1, ARG2) +# define sw_strncat(ARG1, ARG2) strncat(ARG1, ARG2) +# define sw_strchr(ARG1, ARG2) strchr(ARG1, ARG2) +# define sw_strcmp(ARG1, ARG2) strcmp(ARG1, ARG2) +# define sw_strncmp(ARG1, ARG2) strncmp(ARG1, ARG2) +# define sw_strcoll(ARG1, ARG2) strcoll(ARG1, ARG2) +# define sw_strcpy(ARG1, ARG2) ARG2 ? strcpy(ARG1, ARG2) : strcpy(ARG1, "") +# define sw_strncpy(ARG1, ARG2, N) ARG2 ? strncpy(ARG1, ARG2, N) : strcpy(ARG1, "") +# define sw_strcspn(ARG1, ARG2) strcspn(ARG1, ARG2) +# define sw_strlen(ARG1) strlen(ARG1) +# define sw_strstr(ARG1, ARG2) strstr(ARG1, ARG2) +# define sw_strtok_r(ARG1, ARG2, ARG3) strtok_r(ARG1, ARG2, ARG3) + +#endif + + +sw_string +sw_strdup( + sw_const_string str); + + +/* -------------------------------------------------------- + * + * Memory + * + * These macros support cross platform heap functions. + * When compiling with DEBUG, some extra checking is + * done which can aid in tracking down heap corruption + * problems + * + * -------------------------------------------------------- + */ + +#if defined(NDEBUG) + +# define sw_malloc(SIZE) malloc(SIZE) +# define sw_realloc(MEM,SIZE) realloc(MEM, SIZE) +# define sw_free(MEM) if (MEM) free(MEM) + +#else + +# define sw_malloc(SIZE) _sw_debug_malloc(SIZE, __SW_FUNCTION__, __FILE__, __LINE__) +# define sw_realloc(MEM,SIZE) _sw_debug_realloc(MEM, SIZE, __SW_FUNCTION__, __FILE__, __LINE__) +# define sw_free(MEM) if (MEM) _sw_debug_free(MEM, __SW_FUNCTION__, __FILE__, __LINE__) + +#endif + + +sw_opaque HOWL_API +_sw_debug_malloc( + sw_size_t size, + sw_const_string function, + sw_const_string file, + sw_uint32 line); + + +sw_opaque HOWL_API +_sw_debug_realloc( + sw_opaque_t mem, + sw_size_t size, + sw_const_string function, + sw_const_string file, + sw_uint32 line); + + +void HOWL_API +_sw_debug_free( + sw_opaque_t mem, + sw_const_string function, + sw_const_string file, + sw_uint32 line); + + + +/* -------------------------------------------------------- + * + * Sockets + * + * These macros and APIs support cross platform socket + * calls. I am relying on BSD APIs, but even with those + * there are subtle and not so subtle platform differences + * + * -------------------------------------------------------- + */ + +#if defined(__VXWORKS__) + +# include +# include +# include +# include +# include + +typedef int sw_sockdesc_t; +typedef socklen_t sw_socklen_t; + +#elif defined(WIN32) + +# include + +typedef SOCKET sw_sockdesc_t; +typedef int sw_socklen_t; + +# define SW_E_WOULDBLOCK WSAEWOULDBLOCK +# define SW_INVALID_SOCKET INVALID_SOCKET +# define SW_SOCKET_ERROR SOCKET_ERROR + +# define sw_close_socket(X) closesocket(X) + +#else + +# if defined(sun) + +# include + +# endif + +# include +# include + +# if defined(__Lynx__) + +# include + +# else + +# include + +# endif + +# include +# include +# include +# include +# include +# include +# include +# include +# include + +typedef sw_int32 sw_sockdesc_t; +typedef socklen_t sw_socklen_t; + +# define SW_E_WOULDBLOCK EWOULDBLOCK +# define SW_INVALID_SOCKET -1 +# define SW_SOCKET_ERROR -1 + +# define sw_close_socket(X) close(X) + +#endif + + +/* -------------------------------------------------------- + * + * strerror() + * + * This function will print a string rep of a system error + * code + * + * -------------------------------------------------------- + */ + +sw_const_string +sw_strerror(); + + +/* + * Obsolete types and macros. + * + * These are here for backwards compatibility, but will + * be removed in the future + */ +#define sw_char sw_int8 +#define sw_uchar sw_uint8 +#define sw_octet sw_uint8 +#define sw_short sw_int16 +#define sw_ushort sw_uint16 +#define sw_long sw_int32 +#define sw_ulong sw_uint32 + + +#define SW_TRY(EXPR) { sw_result result; if ((result = EXPR) != SW_OKAY) return result; } ((void) 0) +#define SW_TRY_GOTO(EXPR) { if ((result = EXPR) != SW_OKAY) goto exit; } ((void) 0) + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/avahi-compat-howl/include/salt/salt.h b/avahi-compat-howl/include/salt/salt.h new file mode 100644 index 0000000..88ac0d9 --- /dev/null +++ b/avahi-compat-howl/include/salt/salt.h @@ -0,0 +1,215 @@ +#ifndef _sw_salt_h +#define _sw_salt_h + +/* + * Copyright 2003, 2004 Porchdog Software, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of Porchdog Software, Inc. + */ + +#include +#include + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +typedef enum _sw_socket_event +{ + SW_SOCKET_READ = (1 << 0), + SW_SOCKET_WRITE = (1 << 1), + SW_SOCKET_OOB = (1 << 2) +} sw_socket_event; + + +struct _sw_salt; +typedef struct _sw_salt * sw_salt; +struct _sw_socket; +struct _sw_timer; +struct _sw_network_interface; +struct _sw_signal; + +typedef sw_opaque sw_socket_handler; +typedef sw_result +(HOWL_API *sw_socket_handler_func)( + sw_socket_handler handler, + sw_salt salt, + struct _sw_socket * socket, + sw_socket_event events, + sw_opaque extra); + + +typedef sw_opaque sw_timer_handler; +typedef sw_result +(HOWL_API *sw_timer_handler_func)( + sw_timer_handler handler, + sw_salt salt, + struct _sw_timer * timer, + sw_time timeout, + sw_opaque extra); + +typedef sw_opaque sw_network_interface_handler; +typedef sw_result +(HOWL_API *sw_network_interface_handler_func)( + sw_network_interface_handler handler, + sw_salt salt, + struct _sw_network_interface * netif, + sw_opaque extra); + +typedef sw_opaque sw_signal_handler; +typedef sw_result +(HOWL_API *sw_signal_handler_func)( + sw_signal_handler handler, + sw_salt salt, + struct _sw_signal * signal, + sw_opaque extra); + + +sw_result HOWL_API +sw_salt_init( + sw_salt * self, + int argc, + char ** argv); + + +sw_result HOWL_API +sw_salt_fina( + sw_salt self); + + +sw_result HOWL_API +sw_salt_register_socket( + sw_salt self, + struct _sw_socket * socket, + sw_socket_event events, + sw_socket_handler handler, + sw_socket_handler_func func, + sw_opaque extra); + + +sw_result HOWL_API +sw_salt_unregister_socket( + sw_salt self, + struct _sw_socket * socket); + + +sw_result HOWL_API +sw_salt_register_timer( + sw_salt self, + struct _sw_timer * timer, + sw_time timeout, + sw_timer_handler handler, + sw_timer_handler_func func, + sw_opaque extra); + + +sw_result HOWL_API +sw_salt_unregister_timer( + sw_salt self, + struct _sw_timer * timer); + + +sw_result HOWL_API +sw_salt_register_network_interface( + sw_salt self, + struct _sw_network_interface * netif, + sw_network_interface_handler handler, + sw_network_interface_handler_func func, + sw_opaque extra); + + +sw_result HOWL_API +sw_salt_unregister_network_interface_handler( + sw_salt self); + + +sw_result HOWL_API +sw_salt_register_signal( + sw_salt self, + struct _sw_signal * signal, + sw_signal_handler handler, + sw_signal_handler_func func, + sw_opaque extra); + + +sw_result HOWL_API +sw_salt_unregister_signal( + sw_salt self, + struct _sw_signal * signal); + + +sw_result HOWL_API +sw_salt_lock( + sw_salt self); + + +sw_result HOWL_API +sw_salt_unlock( + sw_salt self); + + +sw_result HOWL_API +sw_salt_step( + sw_salt self, + sw_uint32 * msec); + + +sw_result HOWL_API +sw_salt_run( + sw_salt self); + + +sw_result HOWL_API +sw_salt_stop_run( + sw_salt self); + + +#define SW_FALSE 0 +#define SW_TRUE 1 +#define SW_OKAY 0 + + +/* + * error codes + */ +#define SW_E_CORE_BASE 0x80000000 +#define SW_E_UNKNOWN (SW_E_CORE_BASE) + 1 +#define SW_E_INIT (SW_E_CORE_BASE) + 2 +#define SW_E_MEM (SW_E_CORE_BASE) + 3 +#define SW_E_EOF (SW_E_CORE_BASE) + 4 +#define SW_E_NO_IMPL (SW_E_CORE_BASE) + 5 +#define SW_E_FILE_LOCKED (SW_E_CORE_BASE) + 6 +#define SW_E_PROTOCOL_NOT_FOUND (SW_E_CORE_BASE) + 7 + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/avahi-compat-howl/include/salt/signal.h b/avahi-compat-howl/include/salt/signal.h new file mode 100644 index 0000000..2ae5bb3 --- /dev/null +++ b/avahi-compat-howl/include/salt/signal.h @@ -0,0 +1,61 @@ +#ifndef _salt_signal_h +#define _salt_signal_h + +/* + * Copyright 2003, 2004 Porchdog Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of Porchdog Software. + */ + +#include + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +struct _sw_signal; +typedef struct _sw_signal * sw_signal; + + +sw_result HOWL_API +sw_signal_init( + sw_signal * self, + int signal); + + +sw_result HOWL_API +sw_signal_fina( + sw_signal self); + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/avahi-compat-howl/include/salt/socket.h b/avahi-compat-howl/include/salt/socket.h new file mode 100644 index 0000000..88773e4 --- /dev/null +++ b/avahi-compat-howl/include/salt/socket.h @@ -0,0 +1,263 @@ +#ifndef _sw_socket_h +#define _sw_socket_h + +/* + * Copyright 2003, 2004 Porchdog Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of Porchdog Software. + */ + +#include +#include + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +struct _sw_socket; +typedef struct _sw_socket * sw_socket; +struct _sw_socket_options; +typedef struct _sw_socket_options * sw_socket_options; +typedef sw_uint16 sw_port; + + + +sw_result HOWL_API +sw_tcp_socket_init( + sw_socket * self); + + +sw_result HOWL_API +sw_tcp_socket_init_with_desc( + sw_socket * self, + sw_sockdesc_t desc); + + +sw_result HOWL_API +sw_udp_socket_init( + sw_socket * self); + + +sw_result HOWL_API +sw_multicast_socket_init( + sw_socket * self); + + +sw_result HOWL_API +sw_socket_fina( + sw_socket self); + + +sw_result HOWL_API +sw_socket_bind( + sw_socket self, + sw_ipv4_address address, + sw_port port); + + +sw_result HOWL_API +sw_socket_join_multicast_group( + sw_socket self, + sw_ipv4_address local_address, + sw_ipv4_address multicast_address, + sw_uint32 ttl); + + +sw_result HOWL_API +sw_socket_leave_multicast_group( + sw_socket self); + + +sw_result HOWL_API +sw_socket_listen( + sw_socket self, + int qsize); + + +sw_result HOWL_API +sw_socket_connect( + sw_socket self, + sw_ipv4_address address, + sw_port port); + + +sw_result HOWL_API +sw_socket_accept( + sw_socket self, + sw_socket * socket); + + +sw_result HOWL_API +sw_socket_send( + sw_socket self, + sw_octets buffer, + sw_size_t len, + sw_size_t * bytesWritten); + + +sw_result HOWL_API +sw_socket_sendto( + sw_socket self, + sw_octets buffer, + sw_size_t len, + sw_size_t * bytesWritten, + sw_ipv4_address to, + sw_port port); + + +sw_result HOWL_API +sw_socket_recv( + sw_socket self, + sw_octets buffer, + sw_size_t max, + sw_size_t * len); + + +sw_result HOWL_API +sw_socket_recvfrom( + sw_socket self, + sw_octets buffer, + sw_size_t max, + sw_size_t * len, + sw_ipv4_address * from, + sw_port * port, + sw_ipv4_address * dest, + sw_uint32 * interface_index); + + +sw_result HOWL_API +sw_socket_set_blocking_mode( + sw_socket self, + sw_bool blocking_mode); + + +sw_result HOWL_API +sw_socket_set_options( + sw_socket self, + sw_socket_options options); + + +sw_ipv4_address HOWL_API +sw_socket_ipv4_address( + sw_socket self); + + +sw_port HOWL_API +sw_socket_port( + sw_socket self); + + +sw_sockdesc_t HOWL_API +sw_socket_desc( + sw_socket self); + + +sw_result HOWL_API +sw_socket_close( + sw_socket self); + + +sw_result HOWL_API +sw_socket_options_init( + sw_socket_options * self); + + +sw_result HOWL_API +sw_socket_options_fina( + sw_socket_options self); + + +sw_result HOWL_API +sw_socket_options_set_debug( + sw_socket_options self, + sw_bool val); + + +sw_result HOWL_API +sw_socket_options_set_nodelay( + sw_socket_options self, + sw_bool val); + + +sw_result HOWL_API +sw_socket_options_set_dontroute( + sw_socket_options self, + sw_bool val); + + +sw_result HOWL_API +sw_socket_options_set_keepalive( + sw_socket_options self, + sw_bool val); + + +sw_result HOWL_API +sw_socket_options_set_linger( + sw_socket_options self, + sw_bool onoff, + sw_uint32 linger); + + +sw_result HOWL_API +sw_socket_options_set_reuseaddr( + sw_socket_options self, + sw_bool val); + + +sw_result HOWL_API +sw_socket_options_set_rcvbuf( + sw_socket_options self, + sw_uint32 val); + + +sw_result HOWL_API +sw_socket_options_set_sndbuf( + sw_socket_options self, + sw_uint32 val); + + +int +sw_socket_error_code(void); + + +#define SW_E_SOCKET_BASE 0x80000200 +#define SW_E_SOCKET (SW_E_SOCKET_BASE) + 1 +#define SW_E_BIND (SW_E_SOCKET_BASE) + 2 +#define SW_E_GETSOCKNAME (SW_E_SOCKET_BASE) + 3 +#define SW_E_ADD_MEMBERSHIP (SW_E_SOCKET_BASE) + 4 +#define SW_E_MULTICAST_TTL (SW_E_SOCKET_BASE) + 5 +#define SW_E_NOCONNECTION (SW_E_SOCKET_BASE) + 6 +#define SW_E_INPROGRESS (SW_E_SOCKET_BASE) + 7 + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/avahi-compat-howl/include/salt/time.h b/avahi-compat-howl/include/salt/time.h new file mode 100644 index 0000000..b3ec226 --- /dev/null +++ b/avahi-compat-howl/include/salt/time.h @@ -0,0 +1,100 @@ +#ifndef _salt_time_h +#define _salt_time_h + +/* + * Copyright 2003, 2004 Porchdog Software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those + * of the authors and should not be interpreted as representing official policies, + * either expressed or implied, of Porchdog Software. + */ + +#include + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +struct _sw_timer; +typedef struct _sw_timer * sw_timer; + + +sw_result HOWL_API +sw_timer_init( + sw_timer * self); + + +sw_result HOWL_API +sw_timer_fina( + sw_timer self); + + +typedef struct _sw_time +{ + sw_uint32 m_secs; + sw_uint32 m_usecs; +} sw_time; + + +sw_result HOWL_API +sw_time_init( + sw_time * self); + + +sw_result HOWL_API +sw_time_init_now( + sw_time * self); + + +sw_result HOWL_API +sw_time_fina( + sw_time self); + + +sw_time HOWL_API +sw_time_add( + sw_time self, + sw_time y); + + +sw_time HOWL_API +sw_time_sub( + sw_time self, + sw_time y); + + +sw_int32 HOWL_API +sw_time_cmp( + sw_time self, + sw_time y); + + +#ifdef __cplusplus +} +#endif + + +#endif