22#define MIN_PORT_NUMBER_OFFSET 2
23#define MAX_PORT_NUMBER_OFFSET 9999
69 Network::registerContact(c);
75 std::string dbDefault =
":memory:";
76 std::string subdbDefault =
":memory:";
78 if (options.
check(
"memory")) {
79 yCWarning(NAMESERVERCONTAINER,
"The --memory option was given, but that is now a default. Continuing.");
82 std::string dbFilename = options.
check(
"portdb",
83 Value(dbDefault)).asString();
84 std::string subdbFilename = options.
check(
"subdb",
85 Value(subdbDefault)).asString();
87 std::string ip = options.
check(
"ip",
Value(
"...")).asString();
88 int sock = options.
check(
"socket",
Value(Network::getDefaultPortRange())).asInt32();
89 bool cautious = options.
check(
"cautious");
91 yCInfo(NAMESERVERCONTAINER,
"Using port database: %s", dbFilename.c_str());
92 yCInfo(NAMESERVERCONTAINER,
"Using subscription database: %s", subdbFilename.c_str());
93 if (dbFilename!=
":memory:" || subdbFilename!=
":memory:") {
94 yCInfo(NAMESERVERCONTAINER,
"If you ever need to clear the name server's state, just delete those files.");
96 yCInfo(NAMESERVERCONTAINER,
"IP address: %s", (ip==
"...")?
"default":ip.c_str());
97 yCInfo(NAMESERVERCONTAINER,
"Port number: %d", sock);
100 if (options.
check(
"ip")||options.
check(
"socket")) {
101 yCInfo(NAMESERVERCONTAINER,
"Database needs to be reset, IP or port number set.");
106 if (pmem ==
nullptr) {
107 yCError(NAMESERVERCONTAINER,
"Aborting, ports database failed to open.");
111 if (!subscriber.
open(subdbFilename)) {
112 yCError(NAMESERVERCONTAINER,
"Aborting, subscription database failed to open.");
116 contact =
Contact(
"...",
"tcp", ip, sock);
118 if (!options.
check(
"local")) {
119 if (!BootstrapServer::configFileBootstrap(contact,
120 options.
check(
"read"),
121 options.
check(
"write"))) {
122 yCError(NAMESERVERCONTAINER,
"Aborting.\n");
129 alloc.
open(pmem,config);
130 ns.
open(pmem,&alloc,contact);
131 NetworkBase::queryBypass(&ns);
135 combo1.
open(subscriber,style);
#define MAX_PORT_NUMBER_OFFSET
#define MIN_PORT_NUMBER_OFFSET
Multicast and file-based mechanisms for finding the name server.
Collection of carriers, a singleton.
An abstract name space for ports.
virtual Contact getNameServerContact() const =0
Get an address for a name server that manages the name space, if available.
Utilities for manipulating the YARP network, excluding initialization and shutdown.
Utilities for manipulating the YARP network, including initialization and shutdown.
A base class for nested structures that can be searched.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
A single value (typically within a Bottle).
void open(TripleSource *db, const AllocatorConfig &config)
Compose two name services into one.
void open(NameService &ns1, NameService &ns2)
bool open(yarp::os::Searchable &options)
yarp::os::Contact whereDelegate()
~NameServerContainer() override
const yarp::os::Contact & where()
void preregister(const yarp::os::Contact &c)
An implementation of name service operators on a triple store.
void open(TripleSource *db, Allocator *alloc, const yarp::os::Contact &serverContact)
void setSubscriber(Subscriber *subscriber)
bool configure(const yarp::os::Searchable &options)
bool open(const std::string &filename, bool fresh=false)
bool welcome(const std::string &port, int activity) override
void setStore(yarp::os::NameStore &store)
TripleSource * open(const char *filename, bool cautious=false, bool fresh=false)
Abstract view of a database as a collection of triples.
#define yCInfo(component,...)
#define yCError(component,...)
#define yCWarning(component,...)
#define YARP_SERVERSQL_LOG_COMPONENT(name, name_string)