Fawkes API
Fawkes Development Version
network.cpp
1
2
/***************************************************************************
3
* network.cpp - network aspect for Fawkes
4
*
5
* Created: Fri Jun 29 15:17:08 2007 (on flight to RoboCup 2007, Atlanta)
6
* Copyright 2006-2010 Tim Niemueller [www.niemueller.de]
7
*
8
****************************************************************************/
9
10
/* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version. A runtime exception applies to
14
* this software (see LICENSE.GPL_WRE file mentioned below for details).
15
*
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU Library General Public License for more details.
20
*
21
* Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22
*/
23
24
#include <aspect/network.h>
25
26
namespace
fawkes
{
27
28
/** @class NetworkAspect <aspect/network.h>
29
* Thread aspect for network communication.
30
* Give this aspect to your thread if you want to implement custom network
31
* communication. With this aspect you get access to the central network name
32
* resolver and you may publish service on the network and browse for existing
33
* services (for example using mDNS-SD via Avahi).
34
*
35
* It is guaranteed that if used properly from within plugins that
36
* init_NetworkAspect() is called before the thread is started.
37
*
38
* @ingroup Aspects
39
* @author Tim Niemueller
40
*/
41
42
/** @var NetworkNameResolver NetworkAspect::nnresolver
43
* Network name resolver to lookup IP addresses of hostnames and vice versa.
44
* The nnresolver will remain valid for the whole lifetime of the
45
* thread.
46
*/
47
48
/** @var NetworkNameResolver NetworkAspect::service_publisher
49
* Service publisher to publish services on the network.
50
* The service_publisher will remain valid for the whole lifetime of the
51
* thread.
52
*/
53
54
/** @var NetworkNameResolver NetworkAspect::service_browser
55
* Service browser to browse services on the network.
56
* The service_browser will remain valid for the whole lifetime of the
57
* thread.
58
*/
59
60
/** Constructor. */
61
NetworkAspect::NetworkAspect
()
62
{
63
add_aspect
(
"NetworkAspect"
);
64
}
65
66
/** Virtual empty Destructor. */
67
NetworkAspect::~NetworkAspect
()
68
{
69
}
70
71
/** Init network aspect.
72
* It is guaranteed that this is called for a thread having the
73
* netwok aspect before Thread::start() is called (when
74
* running regularly inside Fawkes).
75
* @param resolver network name resolver
76
* @param service_publisher service publisher
77
* @param service_browser service browser
78
*/
79
void
80
NetworkAspect::init_NetworkAspect
(
NetworkNameResolver
*resolver,
81
ServicePublisher
* service_publisher,
82
ServiceBrowser
* service_browser)
83
{
84
this->
nnresolver
= resolver;
85
this->service_publisher =
service_publisher
;
86
this->service_browser =
service_browser
;
87
}
88
89
}
// end namespace fawkes
fawkes::Aspect::add_aspect
void add_aspect(const char *name)
Add an aspect to a thread.
Definition:
aspect.cpp:53
fawkes::NetworkNameResolver
Definition:
resolver.h:48
fawkes::ServiceBrowser
Definition:
service_browser.h:36
fawkes::NetworkAspect::NetworkAspect
NetworkAspect()
Constructor.
Definition:
network.cpp:65
fawkes::NetworkAspect::nnresolver
NetworkNameResolver * nnresolver
Definition:
network.h:54
fawkes
fawkes::NetworkAspect::~NetworkAspect
virtual ~NetworkAspect()
Virtual empty Destructor.
Definition:
network.cpp:71
fawkes::ServicePublisher
Definition:
service_publisher.h:35
fawkes::NetworkAspect::init_NetworkAspect
void init_NetworkAspect(NetworkNameResolver *resolver, ServicePublisher *service_publisher, ServiceBrowser *service_browser)
Init network aspect.
Definition:
network.cpp:84
fawkes::NetworkAspect::service_publisher
ServicePublisher * service_publisher
Definition:
network.h:55
fawkes::NetworkAspect::service_browser
ServiceBrowser * service_browser
Definition:
network.h:56
src
libs
aspect
network.cpp
Generated by
1.8.16