23#include <blackboard/remote.h>
24#include <interfaces/SwitchInterface.h>
25#include <netcomm/fawkes/client.h>
26#include <utils/system/argparser.h>
38print_usage(
const char *program_name)
40 printf(
"Usage: %s [-e interface_id|-d interface_id] [-r host[:port]]\n"
41 " -e Send enable msg to the switch interface specified by interface_id\n"
42 " -d Send disable msg to the switch interface specified by interface_id\n"
43 " -r host[:port] Remote host (and optionally port) to connect to\n\n",
48main(
int argc,
char **argv)
52 if (argp.has_arg(
"h")) {
53 print_usage(argp.program_name());
57 std::string host =
"localhost";
58 unsigned short int port = 1910;
59 if (argp.has_arg(
"r")) {
60 argp.parse_hostport(
"r", host, port);
67 printf(
"Could not connect to host: %s\n", host.c_str());
74 if (argp.has_arg(
"e")) {
75 const char * switch_name = argp.arg(
"e");
81 }
else if (argp.has_arg(
"d")) {
82 const char * switch_name = argp.arg(
"d");
93 printf(
"Error connecting to BlackBoard: %s\n", e.
what());
Parse command line arguments.
The BlackBoard abstract class.
virtual Interface * open_for_reading(const char *interface_type, const char *identifier, const char *owner=NULL)=0
Open interface for reading.
virtual void close(Interface *interface)=0
Close interface.
Base class for exceptions in Fawkes.
virtual const char * what() const noexcept
Get primary string.
Simple Fawkes network client.
void connect()
Connect to remote.
void disconnect()
Disconnect socket.
unsigned int msgq_enqueue(Message *message, bool proxy=false)
Enqueue message at end of queue.
DisableSwitchMessage Fawkes BlackBoard Interface Message.
EnableSwitchMessage Fawkes BlackBoard Interface Message.
SwitchInterface Fawkes BlackBoard Interface.
Fawkes library namespace.