source: source/ariba/utility/bootstrap/modules/multicastdns/MulticastDns.h@ 7532

Last change on this file since 7532 was 7532, checked in by Christoph Mayer, 14 years ago

-von außen konfigurierbare bootstrap module, -periodicbroadcast crash fix

File size: 4.1 KB
RevLine 
[4733]1// [License]
2// The Ariba-Underlay Copyright
3//
4// Copyright (c) 2008-2009, Institute of Telematics, UniversitÀt Karlsruhe (TH)
5//
6// Institute of Telematics
7// UniversitÀt Karlsruhe (TH)
8// Zirkel 2, 76128 Karlsruhe
9// Germany
10//
11// Redistribution and use in source and binary forms, with or without
12// modification, are permitted provided that the following conditions are
13// met:
14//
15// 1. Redistributions of source code must retain the above copyright
16// notice, this list of conditions and the following disclaimer.
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
22// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
25// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32//
33// The views and conclusions contained in the software and documentation
34// are those of the authors and should not be interpreted as representing
35// official policies, either expressed or implied, of the Institute of
36// Telematics.
37// [License]
38
39#ifndef __MULTICAST_DNS_H
40#define __MULTICAST_DNS_H
41
42#include "ariba/config.h"
43
[4836]44#ifdef HAVE_AVAHI_CLIENT_CLIENT_H
[4733]45 #include <avahi-client/client.h>
46 #include <avahi-client/lookup.h>
47 #include <avahi-client/publish.h>
48 #include <avahi-common/alternative.h>
49 #include <avahi-common/thread-watch.h>
50 #include <avahi-common/malloc.h>
51 #include <avahi-common/error.h>
52 #include <avahi-common/timeval.h>
[4836]53#endif // HAVE_AVAHI_CLIENT_CLIENT_H
[4733]54
[4758]55#include <iostream>
56#include <string>
57#include <map>
[4733]58#include <boost/thread/mutex.hpp>
59#include <boost/thread/thread.hpp>
60#include "ariba/utility/bootstrap/modules/BootstrapModule.h"
61#include "ariba/utility/logging/Logging.h"
62
[4758]63using std::string;
64using std::map;
65using std::make_pair;
66
[4733]67namespace ariba {
68namespace utility {
69
70class MulticastDns : public BootstrapModule {
71 use_logging_h(MulticastDns);
72public:
[7532]73 MulticastDns(BootstrapInformationCallback* _callback, string info);
[4733]74 virtual ~MulticastDns();
75
76 virtual void start();
77 virtual void stop();
78
79 virtual string getName();
80 virtual string getInformation();
81 virtual bool isFunctional();
[4836]82 virtual void publishService(string name, string info1, string info2, string info3);
[4733]83 virtual void revokeService(string name);
84
85private:
[4758]86 static const string serviceType;
[4733]87
[4836]88#ifdef HAVE_AVAHI_CLIENT_CLIENT_H
[4733]89
90 AvahiClient* avahiclient;
91 AvahiThreadedPoll* avahipoll;
92 AvahiServiceBrowser* avahibrowser;
93
[4758]94 typedef map<string, AvahiEntryGroup*> AvahiGroupMap;
95 AvahiGroupMap avahigroups;
96
[4733]97 static void client_callback(
98 AvahiClient* client,
99 AvahiClientState state,
100 void* userdata
101 );
102
103 static void entry_group_callback(
104 AvahiEntryGroup* group,
105 AvahiEntryGroupState state,
106 void* userdata);
107
108 static void browse_callback(
109 AvahiServiceBrowser* browser,
110 AvahiIfIndex interface,
111 AvahiProtocol protocol,
112 AvahiBrowserEvent event,
113 const char* name,
114 const char* type,
115 const char* domain,
116 AvahiLookupResultFlags flags,
117 void* userdata);
118
119 static void resolve_callback(
120 AvahiServiceResolver* resolver,
121 AvahiIfIndex interface,
122 AvahiProtocol protocol,
123 AvahiResolverEvent event,
124 const char* name,
125 const char* type,
126 const char* domain,
127 const char* host_name,
128 const AvahiAddress* address,
129 uint16_t port,
130 AvahiStringList* txt,
131 AvahiLookupResultFlags flags,
132 void* userdata
133 );
134
[4836]135#endif // HAVE_AVAHI_CLIENT_CLIENT_H
[4733]136
137};
138
139}} //namespace ariba, utility
140
141#endif // __MULTICAST_DNS_H
Note: See TracBrowser for help on using the repository browser.