]> git.meshlink.io Git - catta/commitdiff
rename server.h to internal.h
authorLennart Poettering <lennart@poettering.net>
Mon, 17 Oct 2005 22:28:01 +0000 (22:28 +0000)
committerLennart Poettering <lennart@poettering.net>
Mon, 17 Oct 2005 22:28:01 +0000 (22:28 +0000)
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@804 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

12 files changed:
avahi-core/Makefile.am
avahi-core/announce.h
avahi-core/browse.h
avahi-core/cache.h
avahi-core/entry.c
avahi-core/iface.h
avahi-core/internal.h [new file with mode: 0644]
avahi-core/multicast-lookup.c
avahi-core/server.c
avahi-core/server.h [deleted file]
avahi-core/wide-area.c
tests/c-plus-plus-test.cc

index 95505b8991b52342c196817a97ac5a8f84976c72..3ecce1135b33d69e90c7446283980389c49af9dc 100644 (file)
@@ -48,7 +48,7 @@ noinst_PROGRAMS = \
 libavahi_core_la_SOURCES = \
        timeeventq.c timeeventq.h\
        iface.c iface.h \
-       server.c server.h entry.c \
+       server.c internal.h entry.c \
        prioq.c prioq.h \
        cache.c cache.h \
        socket.c socket.h \
index 19943126f9764e37860401504761f239d1f72867..3a8bcf351cbc3421009b733c4a168fff15ee5f82 100644 (file)
@@ -26,7 +26,7 @@ typedef struct AvahiAnnouncer AvahiAnnouncer;
 
 #include <avahi-common/llist.h>
 #include "iface.h"
-#include "server.h"
+#include "internal.h"
 #include "timeeventq.h"
 #include "publish.h"
 
index 61ceca7eaa5329969f2fe35626171d9430d35b25..36d4e2e8e2135f57fc58d9d102e0d3cde578ba31 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "core.h"
 #include "timeeventq.h"
-#include "server.h"
+#include "internal.h"
 #include "dns.h"
 #include "lookup.h"
 
index 3d71e504d81ae7857428622ac51f2a14d16a8c56..4fbc1b9f31f7124ba9079c9ac852a385bf78bd6f 100644 (file)
@@ -26,7 +26,7 @@ typedef struct AvahiCache AvahiCache;
 
 #include <avahi-common/llist.h>
 #include "prioq.h"
-#include "server.h"
+#include "internal.h"
 #include "timeeventq.h"
 #include "hashmap.h"
 
index 74f44f1f81aa633364fcf2edeb6f559292a0a7d3..fe7702e01693df42298da09426fa84b54f6ee424 100644 (file)
@@ -38,7 +38,7 @@
 #include <avahi-common/malloc.h>
 #include <avahi-common/error.h>
 
-#include "server.h"
+#include "internal.h"
 #include "iface.h"
 #include "socket.h"
 #include "browse.h"
index 14d0195acee1b6f4cf49874ab0ee0560f51d7037..e45ab107e8f6b48399437361875263aea50220f8 100644 (file)
@@ -30,7 +30,7 @@ typedef struct AvahiHwInterface AvahiHwInterface;
 #include <avahi-common/llist.h>
 #include <avahi-common/address.h>
 
-#include "server.h"
+#include "internal.h"
 #include "cache.h"
 #include "response-sched.h"
 #include "query-sched.h"
diff --git a/avahi-core/internal.h b/avahi-core/internal.h
new file mode 100644 (file)
index 0000000..47a9c84
--- /dev/null
@@ -0,0 +1,208 @@
+#ifndef foointernalhfoo
+#define foointernalhfoo
+
+/* $Id$ */
+
+/***
+  This file is part of avahi.
+  avahi is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as
+  published by the Free Software Foundation; either version 2.1 of the
+  License, or (at your option) any later version.
+  avahi is distributed in the hope that it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+  Public License for more details.
+  You should have received a copy of the GNU Lesser General Public
+  License along with avahi; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+  USA.
+***/
+
+/** A locally registered DNS resource record */
+typedef struct AvahiEntry AvahiEntry;
+
+#include <avahi-common/llist.h>
+#include <avahi-common/watch.h>
+
+#include "core.h"
+#include "iface.h"
+#include "prioq.h"
+#include "timeeventq.h"
+#include "announce.h"
+#include "browse.h"
+#include "dns.h"
+#include "rrlist.h"
+#include "hashmap.h"
+#include "wide-area.h"
+#include "multicast-lookup.h"
+#include "dns-srv-rr.h"
+
+#define AVAHI_MAX_LEGACY_UNICAST_REFLECT_SLOTS 100
+
+#define AVAHI_FLAGS_VALID(flags, max) (!((flags) & ~(max)))
+
+#define AVAHI_RR_HOLDOFF_MSEC 1000
+#define AVAHI_RR_HOLDOFF_MSEC_RATE_LIMIT 60000
+#define AVAHI_RR_RATE_LIMIT_COUNT 15
+
+typedef struct AvahiLegacyUnicastReflectSlot AvahiLegacyUnicastReflectSlot;
+
+struct AvahiLegacyUnicastReflectSlot {
+    AvahiServer *server;
+    
+    uint16_t id, original_id;
+    AvahiAddress address;
+    uint16_t port;
+    int interface;
+    struct timeval elapse_time;
+    AvahiTimeEvent *time_event;
+};
+
+struct AvahiEntry {
+    AvahiServer *server;
+    AvahiSEntryGroup *group;
+
+    int dead;
+    
+    AvahiPublishFlags flags;
+    AvahiRecord *record;
+    AvahiIfIndex interface;
+    AvahiProtocol protocol;
+
+    AVAHI_LLIST_FIELDS(AvahiEntry, entries);
+    AVAHI_LLIST_FIELDS(AvahiEntry, by_key);
+    AVAHI_LLIST_FIELDS(AvahiEntry, by_group);
+    
+    AVAHI_LLIST_HEAD(AvahiAnnouncer, announcers);
+};
+
+struct AvahiSEntryGroup {
+    AvahiServer *server;
+    int dead;
+
+    AvahiEntryGroupState state;
+    void* userdata;
+    AvahiSEntryGroupCallback callback;
+
+    unsigned n_probing;
+    
+    unsigned n_register_try;
+    struct timeval register_time;
+    AvahiTimeEvent *register_time_event;
+
+    struct timeval established_at;
+    
+    AVAHI_LLIST_FIELDS(AvahiSEntryGroup, groups);
+    AVAHI_LLIST_HEAD(AvahiEntry, entries);
+};
+
+struct AvahiServer {
+    const AvahiPoll *poll_api;
+    
+    AvahiInterfaceMonitor *monitor;
+    AvahiServerConfig config;
+
+    AVAHI_LLIST_HEAD(AvahiEntry, entries);
+    AvahiHashmap *entries_by_key;
+
+    AVAHI_LLIST_HEAD(AvahiSEntryGroup, groups);
+    
+    AVAHI_LLIST_HEAD(AvahiSRecordBrowser, record_browsers);
+    AvahiHashmap *record_browser_hashmap;
+    AVAHI_LLIST_HEAD(AvahiSHostNameResolver, host_name_resolvers);
+    AVAHI_LLIST_HEAD(AvahiSAddressResolver, address_resolvers);
+    AVAHI_LLIST_HEAD(AvahiSDomainBrowser, domain_browsers);
+    AVAHI_LLIST_HEAD(AvahiSServiceTypeBrowser, service_type_browsers);
+    AVAHI_LLIST_HEAD(AvahiSServiceBrowser, service_browsers);
+    AVAHI_LLIST_HEAD(AvahiSServiceResolver, service_resolvers);
+    AVAHI_LLIST_HEAD(AvahiSDNSServerBrowser, dns_server_browsers);
+
+    int need_entry_cleanup, need_group_cleanup, need_browser_cleanup;
+    
+    AvahiTimeEventQueue *time_event_queue;
+    
+    char *host_name, *host_name_fqdn, *domain_name;
+
+    int fd_ipv4, fd_ipv6,
+        /* The following two sockets two are used for reflection only */
+        fd_legacy_unicast_ipv4, fd_legacy_unicast_ipv6;
+
+    AvahiWatch *watch_ipv4, *watch_ipv6,
+        *watch_legacy_unicast_ipv4, *watch_legacy_unicast_ipv6;
+
+    AvahiServerState state;
+    AvahiServerCallback callback;
+    void* userdata;
+
+    AvahiSEntryGroup *hinfo_entry_group;
+    AvahiSEntryGroup *browse_domain_entry_group;
+    unsigned n_host_rr_pending;
+
+    /* Used for assembling responses */
+    AvahiRecordList *record_list;
+
+    /* Used for reflection of legacy unicast packets */
+    AvahiLegacyUnicastReflectSlot **legacy_unicast_reflect_slots;
+    uint16_t legacy_unicast_reflect_id;
+
+    /* The last error code */
+    int error;
+
+    /* The local service cookie */
+    uint32_t local_service_cookie;
+
+    AvahiMulticastLookupEngine *multicast_lookup_engine;
+    AvahiWideAreaLookupEngine *wide_area_lookup_engine;
+};
+
+void avahi_entry_free(AvahiServer*s, AvahiEntry *e);
+void avahi_entry_group_free(AvahiServer *s, AvahiSEntryGroup *g);
+
+void avahi_cleanup_dead_entries(AvahiServer *s);
+
+void avahi_server_prepare_response(AvahiServer *s, AvahiInterface *i, AvahiEntry *e, int unicast_response, int auxiliary);
+void avahi_server_prepare_matching_responses(AvahiServer *s, AvahiInterface *i, AvahiKey *k, int unicast_response);
+void avahi_server_generate_response(AvahiServer *s, AvahiInterface *i, AvahiDnsPacket *p, const AvahiAddress *a, uint16_t port, int legacy_unicast, int is_probe);
+
+void avahi_s_entry_group_change_state(AvahiSEntryGroup *g, AvahiEntryGroupState state);
+
+int avahi_entry_is_commited(AvahiEntry *e);
+
+void avahi_server_enumerate_aux_records(AvahiServer *s, AvahiInterface *i, AvahiRecord *r, void (*callback)(AvahiServer *s, AvahiRecord *r, int flush_cache, void* userdata), void* userdata);
+
+void avahi_host_rr_entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void *userdata);
+
+void avahi_server_decrease_host_rr_pending(AvahiServer *s);
+
+int avahi_server_set_errno(AvahiServer *s, int error);
+
+int avahi_server_add_ptr(
+    AvahiServer *s,
+    AvahiSEntryGroup *g,
+    AvahiIfIndex interface,
+    AvahiProtocol protocol,
+    AvahiPublishFlags flags,
+    uint32_t ttl,          
+    const char *name,      
+    const char *dest);
+
+
+#define AVAHI_CHECK_VALIDITY_RETURN_NULL(server, expression, error) { \
+        if (!(expression)) { \
+            avahi_server_set_errno((server), (error)); \
+            return NULL; \
+        } \
+}
+
+#define AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(server, expression, error) {\
+    if (!(expression)) { \
+        ret = avahi_server_set_errno((server), (error)); \
+        goto fail; \
+    } \
+}
+
+#endif
index 339215dde97b2699a76c960c89fb759e215e195b..7ae45eaf89991bcd54c5c534deeb86a66d81fc1c 100644 (file)
@@ -26,7 +26,7 @@
 #include <avahi-common/malloc.h>
 #include <avahi-common/timeval.h>
 
-#include "server.h"
+#include "internal.h"
 #include "browse.h"
 #include "socket.h"
 #include "log.h"
index 2252fde49946c44aced62fe5befb8e3ec77c1861..5651bc16c906ae0866e2a5ef01c4dd7836fd4ba1 100644 (file)
@@ -38,7 +38,7 @@
 #include <avahi-common/malloc.h>
 #include <avahi-common/error.h>
 
-#include "server.h"
+#include "internal.h"
 #include "iface.h"
 #include "socket.h"
 #include "browse.h"
diff --git a/avahi-core/server.h b/avahi-core/server.h
deleted file mode 100644 (file)
index 7181b3c..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-#ifndef fooserverhfoo
-#define fooserverhfoo
-
-/* $Id$ */
-
-/***
-  This file is part of avahi.
-  avahi is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as
-  published by the Free Software Foundation; either version 2.1 of the
-  License, or (at your option) any later version.
-  avahi is distributed in the hope that it will be useful, but WITHOUT
-  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
-  Public License for more details.
-  You should have received a copy of the GNU Lesser General Public
-  License along with avahi; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-  USA.
-***/
-
-/** A locally registered DNS resource record */
-typedef struct AvahiEntry AvahiEntry;
-
-#include <avahi-common/llist.h>
-#include <avahi-common/watch.h>
-
-#include "core.h"
-#include "iface.h"
-#include "prioq.h"
-#include "timeeventq.h"
-#include "announce.h"
-#include "browse.h"
-#include "dns.h"
-#include "rrlist.h"
-#include "hashmap.h"
-#include "wide-area.h"
-#include "multicast-lookup.h"
-#include "dns-srv-rr.h"
-
-#define AVAHI_MAX_LEGACY_UNICAST_REFLECT_SLOTS 100
-
-#define AVAHI_FLAGS_VALID(flags, max) (!((flags) & ~(max)))
-
-#define AVAHI_RR_HOLDOFF_MSEC 1000
-#define AVAHI_RR_HOLDOFF_MSEC_RATE_LIMIT 60000
-#define AVAHI_RR_RATE_LIMIT_COUNT 15
-
-typedef struct AvahiLegacyUnicastReflectSlot AvahiLegacyUnicastReflectSlot;
-
-struct AvahiLegacyUnicastReflectSlot {
-    AvahiServer *server;
-    
-    uint16_t id, original_id;
-    AvahiAddress address;
-    uint16_t port;
-    int interface;
-    struct timeval elapse_time;
-    AvahiTimeEvent *time_event;
-};
-
-struct AvahiEntry {
-    AvahiServer *server;
-    AvahiSEntryGroup *group;
-
-    int dead;
-    
-    AvahiPublishFlags flags;
-    AvahiRecord *record;
-    AvahiIfIndex interface;
-    AvahiProtocol protocol;
-
-    AVAHI_LLIST_FIELDS(AvahiEntry, entries);
-    AVAHI_LLIST_FIELDS(AvahiEntry, by_key);
-    AVAHI_LLIST_FIELDS(AvahiEntry, by_group);
-    
-    AVAHI_LLIST_HEAD(AvahiAnnouncer, announcers);
-};
-
-struct AvahiSEntryGroup {
-    AvahiServer *server;
-    int dead;
-
-    AvahiEntryGroupState state;
-    void* userdata;
-    AvahiSEntryGroupCallback callback;
-
-    unsigned n_probing;
-    
-    unsigned n_register_try;
-    struct timeval register_time;
-    AvahiTimeEvent *register_time_event;
-
-    struct timeval established_at;
-    
-    AVAHI_LLIST_FIELDS(AvahiSEntryGroup, groups);
-    AVAHI_LLIST_HEAD(AvahiEntry, entries);
-};
-
-struct AvahiServer {
-    const AvahiPoll *poll_api;
-    
-    AvahiInterfaceMonitor *monitor;
-    AvahiServerConfig config;
-
-    AVAHI_LLIST_HEAD(AvahiEntry, entries);
-    AvahiHashmap *entries_by_key;
-
-    AVAHI_LLIST_HEAD(AvahiSEntryGroup, groups);
-    
-    AVAHI_LLIST_HEAD(AvahiSRecordBrowser, record_browsers);
-    AvahiHashmap *record_browser_hashmap;
-    AVAHI_LLIST_HEAD(AvahiSHostNameResolver, host_name_resolvers);
-    AVAHI_LLIST_HEAD(AvahiSAddressResolver, address_resolvers);
-    AVAHI_LLIST_HEAD(AvahiSDomainBrowser, domain_browsers);
-    AVAHI_LLIST_HEAD(AvahiSServiceTypeBrowser, service_type_browsers);
-    AVAHI_LLIST_HEAD(AvahiSServiceBrowser, service_browsers);
-    AVAHI_LLIST_HEAD(AvahiSServiceResolver, service_resolvers);
-    AVAHI_LLIST_HEAD(AvahiSDNSServerBrowser, dns_server_browsers);
-
-    int need_entry_cleanup, need_group_cleanup, need_browser_cleanup;
-    
-    AvahiTimeEventQueue *time_event_queue;
-    
-    char *host_name, *host_name_fqdn, *domain_name;
-
-    int fd_ipv4, fd_ipv6,
-        /* The following two sockets two are used for reflection only */
-        fd_legacy_unicast_ipv4, fd_legacy_unicast_ipv6;
-
-    AvahiWatch *watch_ipv4, *watch_ipv6,
-        *watch_legacy_unicast_ipv4, *watch_legacy_unicast_ipv6;
-
-    AvahiServerState state;
-    AvahiServerCallback callback;
-    void* userdata;
-
-    AvahiSEntryGroup *hinfo_entry_group;
-    AvahiSEntryGroup *browse_domain_entry_group;
-    unsigned n_host_rr_pending;
-
-    /* Used for assembling responses */
-    AvahiRecordList *record_list;
-
-    /* Used for reflection of legacy unicast packets */
-    AvahiLegacyUnicastReflectSlot **legacy_unicast_reflect_slots;
-    uint16_t legacy_unicast_reflect_id;
-
-    /* The last error code */
-    int error;
-
-    /* The local service cookie */
-    uint32_t local_service_cookie;
-
-    AvahiMulticastLookupEngine *multicast_lookup_engine;
-    AvahiWideAreaLookupEngine *wide_area_lookup_engine;
-};
-
-void avahi_entry_free(AvahiServer*s, AvahiEntry *e);
-void avahi_entry_group_free(AvahiServer *s, AvahiSEntryGroup *g);
-
-void avahi_cleanup_dead_entries(AvahiServer *s);
-
-void avahi_server_prepare_response(AvahiServer *s, AvahiInterface *i, AvahiEntry *e, int unicast_response, int auxiliary);
-void avahi_server_prepare_matching_responses(AvahiServer *s, AvahiInterface *i, AvahiKey *k, int unicast_response);
-void avahi_server_generate_response(AvahiServer *s, AvahiInterface *i, AvahiDnsPacket *p, const AvahiAddress *a, uint16_t port, int legacy_unicast, int is_probe);
-
-void avahi_s_entry_group_change_state(AvahiSEntryGroup *g, AvahiEntryGroupState state);
-
-int avahi_entry_is_commited(AvahiEntry *e);
-
-void avahi_server_enumerate_aux_records(AvahiServer *s, AvahiInterface *i, AvahiRecord *r, void (*callback)(AvahiServer *s, AvahiRecord *r, int flush_cache, void* userdata), void* userdata);
-
-void avahi_host_rr_entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void *userdata);
-
-void avahi_server_decrease_host_rr_pending(AvahiServer *s);
-
-int avahi_server_set_errno(AvahiServer *s, int error);
-
-int avahi_server_add_ptr(
-    AvahiServer *s,
-    AvahiSEntryGroup *g,
-    AvahiIfIndex interface,
-    AvahiProtocol protocol,
-    AvahiPublishFlags flags,
-    uint32_t ttl,          
-    const char *name,      
-    const char *dest);
-
-
-#define AVAHI_CHECK_VALIDITY_RETURN_NULL(server, expression, error) { \
-        if (!(expression)) { \
-            avahi_server_set_errno((server), (error)); \
-            return NULL; \
-        } \
-}
-
-#define AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(server, expression, error) {\
-    if (!(expression)) { \
-        ret = avahi_server_set_errno((server), (error)); \
-        goto fail; \
-    } \
-}
-
-#endif
index f32c403c1643617ac436e41ba1df1b69a973551d..c5508b0c187d78412db5bf45b0196989323a3e53 100644 (file)
@@ -32,7 +32,7 @@
 #include <avahi-common/error.h>
 #include <avahi-common/timeval.h>
 
-#include "server.h"
+#include "internal.h"
 #include "browse.h"
 #include "socket.h"
 #include "log.h"
index b1b324cff86432ab5ed1bb50ba2d97d769372d31..fcdc7a467df582d14c241ef736c573b56f5edbba 100644 (file)
 #include <avahi-core/browse.h>
 #include <avahi-core/cache.h>
 #include <avahi-core/core.h>
+#include <avahi-core/dns-srv-rr.h>
 #include <avahi-core/dns.h>
 #include <avahi-core/fdutil.h>
 #include <avahi-core/hashmap.h>
 #include <avahi-core/iface-linux.h>
 #include <avahi-core/iface.h>
+#include <avahi-core/internal.h>
 #include <avahi-core/log.h>
 #include <avahi-core/lookup.h>
 #include <avahi-core/multicast-lookup.h>
 #include <avahi-core/response-sched.h>
 #include <avahi-core/rr.h>
 #include <avahi-core/rrlist.h>
-#include <avahi-core/server.h>
 #include <avahi-core/socket.h>
 #include <avahi-core/timeeventq.h>
 #include <avahi-core/util.h>
 #include <avahi-core/wide-area.h>
 #include <avahi-client/client.h>
 #include <avahi-client/internal.h>
+#include <avahi-client/lookup.h>
+#include <avahi-client/publish.h>
 #include <avahi-glib/glib-malloc.h>
 #include <avahi-glib/glib-watch.h>