Changeset 4836 for source/ariba/utility/bootstrap/modules/multicastdns
- Timestamp:
- Jul 9, 2009, 1:50:37 PM (15 years ago)
- Location:
- source/ariba/utility/bootstrap/modules/multicastdns
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/utility/bootstrap/modules/multicastdns/MulticastDns.cpp
r4758 r4836 46 46 47 47 MulticastDns::MulticastDns(BootstrapInformationCallback* _callback) : BootstrapModule(_callback) { 48 #ifdef HAVE_ LIBAVAHI_CLIENT48 #ifdef HAVE_AVAHI_CLIENT_CLIENT_H 49 49 avahiclient = NULL; 50 50 avahipoll = NULL; 51 51 avahibrowser = NULL; 52 #endif // HAVE_ LIBAVAHI_CLIENT52 #endif // HAVE_AVAHI_CLIENT_CLIENT_H 53 53 } 54 54 … … 65 65 66 66 bool MulticastDns::isFunctional(){ 67 #ifdef HAVE_ LIBAVAHI_CLIENT67 #ifdef HAVE_AVAHI_CLIENT_CLIENT_H 68 68 return true; 69 69 #else … … 73 73 74 74 void MulticastDns::start(){ 75 #ifdef HAVE_ LIBAVAHI_CLIENT75 #ifdef HAVE_AVAHI_CLIENT_CLIENT_H 76 76 77 77 int error = 0; … … 110 110 avahi_threaded_poll_start( avahipoll ); 111 111 112 #endif // HAVE_ LIBAVAHI_CLIENT112 #endif // HAVE_AVAHI_CLIENT_CLIENT_H 113 113 } 114 114 115 115 void MulticastDns::stop(){ 116 #ifdef HAVE_ LIBAVAHI_CLIENT116 #ifdef HAVE_AVAHI_CLIENT_CLIENT_H 117 117 118 118 // … … 144 144 avahipoll = NULL; 145 145 146 #endif // HAVE_ LIBAVAHI_CLIENT147 } 148 149 void MulticastDns::publishService(string name, string info ){150 #ifdef HAVE_ LIBAVAHI_CLIENT146 #endif // HAVE_AVAHI_CLIENT_CLIENT_H 147 } 148 149 void MulticastDns::publishService(string name, string info1, string info2, string info3){ 150 #ifdef HAVE_AVAHI_CLIENT_CLIENT_H 151 151 152 152 if(name.length() > 63){ … … 198 198 NULL, // host name of our machine, let avahi find out 199 199 3333, // port number the service is on, just dummy, everything is encoded in TXT 200 info.c_str(), // arbitrary info 200 info1.c_str(), // arbitrary info 201 info2.c_str(), // arbitrary info 202 info3.c_str(), // arbitrary info 201 203 NULL); // make that this is the last info field 202 204 … … 219 221 avahi_threaded_poll_unlock(avahipoll); 220 222 221 #endif // HAVE_ LIBAVAHI_CLIENT223 #endif // HAVE_AVAHI_CLIENT_CLIENT_H 222 224 } 223 225 224 226 void MulticastDns::revokeService(string name){ 225 #ifdef HAVE_ LIBAVAHI_CLIENT227 #ifdef HAVE_AVAHI_CLIENT_CLIENT_H 226 228 227 229 avahi_threaded_poll_lock(avahipoll); … … 239 241 avahi_threaded_poll_unlock(avahipoll); 240 242 241 #endif // HAVE_ LIBAVAHI_CLIENT242 } 243 244 #ifdef HAVE_ LIBAVAHI_CLIENT243 #endif // HAVE_AVAHI_CLIENT_CLIENT_H 244 } 245 246 #ifdef HAVE_AVAHI_CLIENT_CLIENT_H 245 247 246 248 void MulticastDns::client_callback(AvahiClient* client, AvahiClientState state, void* userdata){ … … 395 397 396 398 char addr[AVAHI_ADDRESS_STR_MAX]; 397 char* text = NULL;398 399 399 400 avahi_address_snprint(addr, sizeof(addr), address); 400 text = avahi_string_list_to_string(txt); 401 402 string info1 = ""; 403 string info2 = ""; 404 string info3 = ""; 405 406 if(txt != NULL){ 407 char* cinfo = avahi_string_list_to_string(txt); 408 info1 = cinfo; 409 avahi_free(cinfo); 410 } 411 412 if(txt != NULL && avahi_string_list_get_next(txt) != NULL){ 413 char* cinfo = avahi_string_list_to_string( avahi_string_list_get_next(txt) ); 414 info2 = cinfo; 415 avahi_free(cinfo); 416 } 417 418 if(txt != NULL && avahi_string_list_get_next(txt) != NULL){ 419 char* cinfo = avahi_string_list_to_string( avahi_string_list_get_next(txt) ); 420 info3 = cinfo; 421 avahi_free(cinfo); 422 } 401 423 402 424 if(obj != NULL && obj->callback != NULL) 403 obj->callback->onBootstrapServiceFound(name, text); 404 405 avahi_free( text ); 425 obj->callback->onBootstrapServiceFound(name, info1, info2, info3); 426 406 427 break; 407 428 } … … 410 431 } 411 432 412 #endif // HAVE_ LIBAVAHI_CLIENT433 #endif // HAVE_AVAHI_CLIENT_CLIENT_H 413 434 414 435 }} //namespace ariba, utility -
source/ariba/utility/bootstrap/modules/multicastdns/MulticastDns.h
r4758 r4836 42 42 #include "ariba/config.h" 43 43 44 #ifdef HAVE_ LIBAVAHI_CLIENT44 #ifdef HAVE_AVAHI_CLIENT_CLIENT_H 45 45 #include <avahi-client/client.h> 46 46 #include <avahi-client/lookup.h> … … 51 51 #include <avahi-common/error.h> 52 52 #include <avahi-common/timeval.h> 53 #endif 53 #endif // HAVE_AVAHI_CLIENT_CLIENT_H 54 54 55 55 #include <iostream> … … 80 80 virtual string getInformation(); 81 81 virtual bool isFunctional(); 82 virtual void publishService(string name, string info );82 virtual void publishService(string name, string info1, string info2, string info3); 83 83 virtual void revokeService(string name); 84 84 … … 86 86 static const string serviceType; 87 87 88 #ifdef HAVE_ LIBAVAHI_CLIENT88 #ifdef HAVE_AVAHI_CLIENT_CLIENT_H 89 89 90 90 AvahiClient* avahiclient; … … 133 133 ); 134 134 135 #endif // HAVE_ LIBAVAHI_CLIENT135 #endif // HAVE_AVAHI_CLIENT_CLIENT_H 136 136 137 137 };
Note:
See TracChangeset
for help on using the changeset viewer.