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