Esempio n. 1
0
void cli_nuke_hw_arp_cache_entry(router_state *rs, cli_request *req) {

	if(rs->is_netfpga) {
		unsigned int row;

		if( sscanf(req->command, "nuke hw arp %ui", &row) != 1) {
			send_to_socket(req->sockfd, "Failure to read arguments.\n", strlen("Failure reading arguments.\n"));
			return;
		}

		if(row > (ROUTER_OP_LUT_ARP_TABLE_DEPTH - 1)) {
			send_to_socket(req->sockfd, "Specified invalid row\n", strlen("Specified invalid row\n"));
			return;
		}


		/* zero out the rest of the row */
		writeReg(rs->netfpga_regs, ROUTER_OP_LUT_ARP_TABLE_ENTRY_MAC_HI_REG, 0);
		writeReg(rs->netfpga_regs, ROUTER_OP_LUT_ARP_TABLE_ENTRY_MAC_LO_REG, 0);
		writeReg(rs->netfpga_regs, ROUTER_OP_LUT_ARP_TABLE_ENTRY_NEXT_HOP_IP_REG, 0);
		writeReg(rs->netfpga_regs, ROUTER_OP_LUT_ARP_TABLE_WR_ADDR_REG, row);

		char *msg = (char *)calloc(80, sizeof(char));
		snprintf(msg, 80, "Row %d has been nuked\n", row);
		send_to_socket(req->sockfd, msg, strlen(msg));
		free(msg);
	}

}
Esempio n. 2
0
void cli_hw_help(router_state *rs, cli_request* req) {
	char *usage;

	usage = "\tshow hw rtable\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\tshow hw arp\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\tshow hw iface\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\tnuke arp\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\tnuke hw arp [row]\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\thw iface add [eth0 eth1 eth2 eth3] [mac addr]\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\thw iface del [eth0 eth1 eth2 eth3]\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\thw iface [eth0 eth1 eth2 eth3] up\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\thw iface [eth0 eth1 eth2 eth3] down\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\thw packts fwd\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

}
Esempio n. 3
0
void Socket::create_and_connect()
{
    addrinfo* serverinfo;
    int res;

    if ((res = get_addr_info(&serverinfo)) != 0)
    {
        throw std::system_error(errno, std::system_category(),
                                REPORT_ERROR("getaddrinfo failure: " +
                                std::string(gai_strerror(res))));
    }

    try
    {
        create_socket(serverinfo);
        connect_socket(serverinfo);
    }
    catch (std::system_error const& err)
    {
        freeaddrinfo(serverinfo);
        close(sock);
        throw err;
    }

    freeaddrinfo(serverinfo);

    if (!server_info.password.empty())
        send_to_socket("PASS " + server_info.password + "\r\n");

    send_to_socket("NICK " + server_info.nick + "\r\n");
    send_to_socket("USER " + server_info.user + "\r\n");
}
Esempio n. 4
0
void cli_ip_arp_help(router_state *rs, cli_request* req) {
	char *usage0 = "usage: ip arp <args>\n";
	send_to_socket(req->sockfd, usage0, strlen(usage0));

	char *usage1 = "ip arp add ip MAC\n";
	send_to_socket(req->sockfd, usage1, strlen(usage1));

	char *usage2 = "ip arp del ip\n";
	send_to_socket(req->sockfd, usage2, strlen(usage2));
}
Esempio n. 5
0
void* process_client_request(void *arg) {

	cli_client_thread_info *cli_info = (cli_client_thread_info *)arg;
	int ret = 0;
	char buf[MAX_COMMAND_SIZE];
	bzero(buf, MAX_COMMAND_SIZE);



	send_to_socket(cli_info->sockfd, "> ", sizeof("> "));
	while(1) {

		/* get client's cli command */
		if( !(ret = recv(cli_info->sockfd, buf, MAX_COMMAND_SIZE, 0)) ) {
			continue;
		}
		if(ret <= 0) {
			printf("recv(..) error %d\n", ret);
			return NULL;
		}

		/* get rid of \r\n or \n when you hit enter in telnet */
	       	cleanCRLFs(buf);

		if(strncmp(buf, "exit", strlen("exit")) == 0) {
			send_to_socket(cli_info->sockfd, "bye!\n", strlen("bye!\n"));
			close(cli_info->sockfd);
			return NULL;
		}


		/* build the cli_request object */
		cli_request* req = (cli_request *)malloc(sizeof(cli_request));
		req->command = mallocCopy(buf);
		req->sockfd = cli_info->sockfd;

		cli_command_handler handler = cli_command_lpm(cli_info->rs, req->command);
		if(handler == NULL) {

			char *error = "invalid command ... type ? or help for valid command help\n";
			send_to_socket(req->sockfd, error, strlen(error));

		}
		else {
			(*handler)(cli_info->rs, req);
		}

		free(req->command);
		free(req);

		send_to_socket(cli_info->sockfd, "> ", sizeof("> "));
	}

}
Esempio n. 6
0
void cli_show_help(router_state *rs, cli_request* req) {

	char *usage0 = "usage: show <args>\n";
	send_to_socket(req->sockfd, usage0, strlen(usage0));

	char *usage1 = "show vns [user server vhost lhost topology]\n";
	send_to_socket(req->sockfd, usage1, strlen(usage1));

	char *usage2 = "show ip [route interface arp]\n";
	send_to_socket(req->sockfd, usage2, strlen(usage2));
}
Esempio n. 7
0
void cli_show_ip_arp(router_state* rs, cli_request* req) {
	char *arp_cache_info;
	int len;

	char ttl_info[32];
	snprintf(ttl_info, 32, "Arp Cache TTL: %5u seconds\n\n", rs->arp_ttl);
	send_to_socket(req->sockfd, ttl_info, strlen(ttl_info));

	lock_arp_cache_rd(rs);
	sprint_arp_cache(rs, &arp_cache_info, &len);
	unlock_arp_cache(rs);

	send_to_socket(req->sockfd, arp_cache_info, len);
	free(arp_cache_info);
}
Esempio n. 8
0
void show_page(SOCKET_DATA *dsock, int page_num) {
  static char buf[MAX_BUFFER];
  char *page = dsock->page_string;
  *buf = '\0';
  int buf_i = 0, newline_count = 0, curr_page = 1;

  // skip to our page
  while(*page && curr_page < page_num) {
    if(*page == '\n')
      newline_count++;
    if(newline_count >= NUM_LINES_PER_PAGE) {
      curr_page++;
      newline_count = 0;
    }
    page++;
  }

  // copy our page to the buf
  while(*page && newline_count < NUM_LINES_PER_PAGE) {
    if(*page == '\n')
      newline_count++;
    buf[buf_i] = *page;
    page++;
    buf_i++;
  }

  buf[buf_i] = '\0';
  text_to_buffer(dsock, buf);
  if(dsock->tot_pages != 1)
    send_to_socket(dsock, "{c[{ypage %d of %d. Use MORE to view next page or BACK to view previous{c]{n\r\n",
		   page_num, dsock->tot_pages);
}
void dump_and_send(int fd, int flags, const char *buf, unsigned len)
{
  if ((flags & PRINT_OUT) || PRINT_STDOUT_BIT1()) {
    dump_to_std(buf, len, "OUT", 0, 0);
  }
  send_to_socket(fd, buf, len);
}
Esempio n. 10
0
void cli_ip_arp_set_ttl(router_state *rs, cli_request *req) {

	unsigned int timeout;

	if( sscanf(req->command, "ip arp set ttl %ui", &timeout) != 1 ) {
		send_to_socket(req->sockfd, "Syntax error\n", strlen("Syntax error\n"));
		return;
	}

	rs->arp_ttl = timeout;

	char *info = (char *)calloc(80, sizeof(char));
	snprintf(info, 80, "Arp entry TTL has been set to: %d\n", rs->arp_ttl);
	send_to_socket(req->sockfd, info, strlen(info));
	free(info);
}
Esempio n. 11
0
// the resedit olc needs these declared
void iedit_furniture_menu(SOCKET_DATA *sock, FURNITURE_DATA *data) {
  send_to_socket(sock, 
		 "{g1) Capacity: {c%d\r\n"
		 "{g2) Sit Type: {c%s\r\n",
		 data->capacity,
		 furnitureTypeGetName(data->type));
}
Esempio n. 12
0
void extenderDoMenu(SOCKET_DATA *sock, OLC_EXTENDER *ext, void *data) {
  LIST           *keys = hashCollect(ext->opt_hash);
  char            *key = NULL;
  OLC_EXT_DATA  *edata = NULL;

  // display each menu item alphabetically
  listSortWith(keys, strcasecmp);
  LIST_ITERATOR *key_i = newListIterator(keys);
  ITERATE_LIST(key, key_i) {
    // display the menu option
    send_to_socket(sock, "{g%s) ", key);

    // then display the information
    edata = hashGet(ext->opt_hash, key);
    if(edata->type == OLCEXT_C)
      edata->menu(sock, data);
    else if(ext->borrow_py != NULL) {
      PyObject *ret = PyObject_CallFunction(edata->pymenu, "OO", 
					    socketGetPyFormBorrowed(sock), 
					    ext->borrow_py(data));
      if(ret == NULL)
	log_pyerr("Error running Python OLC exention menu function: %s", key);
      Py_XDECREF(ret);
    }
  } deleteListIterator(key_i);
Esempio n. 13
0
void		ft_ping(char **av)
{
	char				ip[100];

	if (ft_isalpha(av[1][0]))
		hostname_to_ip(av[1] , ip);
	send_to_socket(ip);
}
Esempio n. 14
0
int send_message_no_delay(char* message)
{
    int result = 0;

    result = send_to_socket(message, &socket_id_commands, &addr_dest_commands);

    return result;
}
Esempio n. 15
0
static void read_cb(struct ev_loop *loop, struct ev_io *watcher, int revents) {

	if(EV_ERROR & revents) {
		rdlog(LOG_ERR,"Read callback error: %s",mystrerror(errno,errbuf,
			ERROR_BUFFER_SIZE));
	}

	struct connection_private *connection = (struct connection_private *) watcher->data;
	struct sockaddr_in6 saddr;

#ifdef CONNECTION_PRIVATE_MAGIC
	assert(connection->magic == CONNECTION_PRIVATE_MAGIC);
#endif

	char *buffer = calloc(READ_BUFFER_SIZE,sizeof(char));
	const int recv_result = receive_from_socket(watcher->fd,&saddr,buffer,READ_BUFFER_SIZE);
	if(recv_result > 0){
		process_data_received_from_socket(buffer,(size_t)recv_result,connection->client,
		            connection->callback,connection->callback_opaque);
	}else if(recv_result < 0){
		if(errno == EAGAIN){
			rdbg("Socket not ready. re-trying");
			free(buffer);
			return;
		}else{
			rdlog(LOG_ERR,"Recv error: %s",mystrerror(errno,errbuf,ERROR_BUFFER_SIZE));
			free(buffer);
			close_socket_and_stop_watcher(loop,watcher);
			return;
		}
	}else{ /* recv_result == 0 */
		free(buffer);
		close_socket_and_stop_watcher(loop,watcher);
		return;
	}

	if(NULL!=global_config.response && !connection->first_response_sent){
		int send_ret = 1;
		rdlog(LOG_DEBUG,"Sending first response...");

		if(global_config.response_len == 0){
			rdlog(LOG_ERR,"Can't send first response to %s: size of response == 0",connection->client);
			connection->first_response_sent = 1;
		} else {
			send_ret = send_to_socket(watcher->fd,global_config.response,(size_t)global_config.response_len-1);
		}

		if(send_ret <= 0){
			rdlog(LOG_ERR,"Cannot send first response to %s socket: %s",
				connection->client, mystrerror(errno,errbuf,ERROR_BUFFER_SIZE));
			close_socket_and_stop_watcher(loop,watcher);
		}
		
		rdlog(LOG_DEBUG,"first response ok");
		connection->first_response_sent = 1;
	}
}
Esempio n. 16
0
int hedit_chooser(SOCKET_DATA *sock, HELP_OLC *data, const char *option) {
  switch(toupper(*option)) {
  case '1':
    send_to_socket(sock, "Enter the keywords that reference this helpfile: ");
    return HEDIT_KEYWORDS;
  case '2':
    send_to_socket(sock, "Enter the names of related helpfiles: ");
    return HEDIT_RELATED;
  case '3':
    send_to_socket(sock, "Which user groups are this helpfile limited to: ");
    return HEDIT_USER_GROUPS;
  case '4':
    text_to_buffer(sock, "Enter Helpfile Information\r\n");
    socketStartEditor(sock, text_editor, data->info);
    return MENU_NOCHOICE;
  default: 
    return MENU_CHOICE_INVALID;
  }
}
Esempio n. 17
0
void cli_show_hw_arp_cache(router_state *rs, cli_request *req) {

	if(rs->is_netfpga) {
		char *arp_info = 0;
		unsigned int len;

		sprint_hw_arp_cache(rs, &arp_info, &len);
		send_to_socket(req->sockfd, arp_info, len);
		free(arp_info);
	}
}
Esempio n. 18
0
// the resedit olc needs these declared
void iedit_container_menu   (SOCKET_DATA *sock, CONTAINER_DATA *data) {
  send_to_socket(sock, 
		 "{g1) Capacity : {c%1.2lf\r\n"
		 "{g2) Key      : {c%s\r\n"
		 "{g3) Closable : {c%s\r\n"
		 "{g4) Pick diff: {c%d\r\n",
		 data->capacity,
		 data->key,
		 (data->closable ? "yes" : "no"),
		 data->pick_diff);
}
Esempio n. 19
0
void hedit_menu(SOCKET_DATA *sock, HELP_OLC *data) {
  send_to_socket(sock,
		 "{g1) keywords         : {c%s\r\n"
		 "{g2) related          : {c%s\r\n"
		 "{g3) group restriction: {c%s\r\n"
		 "{g4) Info:\r\n"
		 "{c%s",
		 data->keywords,
		 data->related,
		 data->user_groups,
		 bufferString(data->info));
}
Esempio n. 20
0
void cli_ip_arp_add(router_state *rs, cli_request *req) {
	char *ip_str;
	unsigned char mac[ETH_ADDR_LEN];
	unsigned int mac_int[ETH_ADDR_LEN];

	if (sscanf(req->command, "ip arp add %as %2X:%2X:%2X:%2X:%2X:%2X", &ip_str,
			mac_int, (mac_int+1), (mac_int+2), (mac_int+3), (mac_int+4), (mac_int+5)) != 7) {
		send_to_socket(req->sockfd, "Failure reading arguments.\n", strlen("Failure reading arguments.\n"));
		return;
	}

	int i;
	for (i = 0; i < 6; ++i) {
		mac[i] = (unsigned char)mac_int[i];
	}

	struct in_addr ip;
	if (inet_pton(AF_INET, ip_str, &ip) != 1) {
		send_to_socket(req->sockfd, "Failure reading ip.\n", strlen("Failure reading ip.\n"));
		return;
	}


	lock_arp_cache_wr(rs);

	int result = update_arp_cache(rs->sr, &ip, mac, 1);

	unlock_arp_cache(rs);

	char* message;
	if (result != 0) {
		message = "Failure adding arp cache entry.\n";
	} else {
		message = "Successfully added arp cache entry.\n";
	}
	send_to_socket(req->sockfd, message, strlen(message));

	free(ip_str);
}
Esempio n. 21
0
void cli_hw_arp_cache_misses(router_state *rs, cli_request *req) {

	if(rs->is_netfpga) {
		unsigned int misses = 0;
		readReg(rs->netfpga_regs, ROUTER_OP_LUT_ARP_NUM_MISSES_REG, &misses);

		char *info = (char *)calloc(80, sizeof(char));
		snprintf(info, 80, "HW ARP CACHE MISSES: %d\n", ntohl(misses));
		send_to_socket(req->sockfd, info, strlen(info));
		free(info);
	}

}
Esempio n. 22
0
void cli_hw_num_pckts_fwd(router_state *rs, cli_request *req) {

	if(rs->is_netfpga) {
		unsigned int number = 0;
		readReg(rs->netfpga_regs, ROUTER_OP_LUT_NUM_PKTS_FORWARDED_REG, &number);

		char *info = (char *)calloc(80, sizeof(char));
		snprintf(info, 80, "HW NUMBER OF PACKETS FORWARDED: %d\n", ntohl(number));
		send_to_socket(req->sockfd, info, strlen(info));
		free(info);
	}

}
Esempio n. 23
0
void cli_ip_arp_del(router_state *rs, cli_request *req) {
	char *ip_str;

	if (sscanf(req->command, "ip arp del %as", &ip_str) != 1) {
		send_to_socket(req->sockfd, "Failure reading arguments.\n", strlen("Failure reading arguments.\n"));
		return;
	}

	struct in_addr ip;
	if (inet_pton(AF_INET, ip_str, &ip) != 1) {
		send_to_socket(req->sockfd, "Failure reading ip.\n", strlen("Failure reading ip.\n"));
		return;
	}


	lock_arp_cache_wr(rs);

	int result = del_arp_cache(rs->sr, &ip);

	/* update the hw arp cache */
	if(result > 0) {
		trigger_arp_cache_modified(rs);
	}
	unlock_arp_cache(rs);

	char* result_str = (char*)calloc(1, 256);
	if (result != 1) {
		snprintf(result_str, 256, "%i arp cache entries deleted.\n", result);
	} else {
		snprintf(result_str, 256, "%i arp cache entry deleted.\n", result);
	}

	send_to_socket(req->sockfd, result_str, strlen(result_str));

	free(result_str);
	free(ip_str);
}
Esempio n. 24
0
void cli_hw_arp_cache_misses(router_state *rs, cli_request *req) {

	if(rs->is_netfpga) {
		unsigned int misses = 0;
		int err;
		err=nf10_reg_rd(ROUTER_OP_LUT_ARP_NUM_MISSES_REG, &misses);
        	if(err) printf("0x%08x: ERROR: %s\n", ROUTER_OP_LUT_ARP_NUM_MISSES_REG, nl_geterror(err));

		char *info = (char *)calloc(80, sizeof(char));
		snprintf(info, 80, "HW ARP CACHE MISSES: %d\n", ntohl(misses));
		send_to_socket(req->sockfd, info, strlen(info));
		free(info);
	}

}
Esempio n. 25
0
void cli_hw_num_pkts_fwd(router_state *rs, cli_request *req) {

	if(rs->is_netfpga) {
		unsigned int number = 0;
		int err;
                err=nf10_reg_rd(ROUTER_OP_LUT_NUM_PKTS_FORWARDED_REG, &number);
                if(err) printf("0x%08x: ERROR: %s\n", ROUTER_OP_LUT_NUM_PKTS_FORWARDED_REG, nl_geterror(err));

		char *info = (char *)calloc(80, sizeof(char));
		snprintf(info, 80, "HW NUMBER OF PACKETS FORWARDED: %d\n", ntohl(number));
		send_to_socket(req->sockfd, info, strlen(info));
		free(info);
	}

}
Esempio n. 26
0
PyObject *PySocket_send_raw(PySocket *self, PyObject *value) {
  char *mssg = NULL;
  if (!PyArg_ParseTuple(value, "s", &mssg)) {
    PyErr_Format(PyExc_TypeError, "Sockets may only be sent strings");
    return NULL;
  }

  SOCKET_DATA *sock = PySocket_AsSocket((PyObject *)self);
  if(sock != NULL) {
    send_to_socket(sock, "%s", mssg);
    return Py_BuildValue("i", 1);
  }
  else {
    PyErr_Format(PyExc_TypeError, 
		 "Tried to send message to nonexistant socket, %d.", 
		 self->uid);
    return NULL;
  }
}
int CHttpRequestHandler::send_from_socket_to_another(int from, int to)
{
	char buffer[4*1024];
	int size = receive_from_socket(from, buffer, sizeof(buffer), true);
	if(size==0)
	{
		//syslog(0,"send_from_socket_to_another(from=%d, to=%d): close socket", from, to);
		return -1;
	}
	else if(size<0 && errno!=EAGAIN)
	{
		//syslog(0,"send_from_socket_to_another(from=%d, to=%d): close socket %s", from, to, strerror(errno));
		return -1;
	}
	else if(size>0)
	{
		return send_to_socket(to, buffer, size);
	}
	return 0;
}
Esempio n. 28
0
void cli_nuke_arp_cache(router_state *rs, cli_request *req) {

	lock_arp_cache_wr(rs);

	/* destroy the sw arp cache */
	node *cur = rs->arp_cache;
	while(cur) {
		node *next = cur->next;
		node_remove(&rs->arp_cache, cur);

		cur = next;
	}

	/* zero out the hw arp cache */
	if(rs->is_netfpga) {
		trigger_arp_cache_modified(rs);
	}

	unlock_arp_cache(rs);

	char *info = "SW and HW arp cache info was nuked\n";
	send_to_socket(req->sockfd, info, strlen(info));
}
Esempio n. 29
0
void cli_nat_test(router_state *rs, cli_request *req) {

	char *msg;
	char line[1024];
	int sockfd;
	struct sockaddr_in servaddr;
	struct hostent *servhost;
	int error;

	servhost = gethostbyname("www.cs.stanford.edu");
	if(servhost == NULL) {
		msg = "GetHostByName Error: 'www.cs.stanford.edu'\n";
		send_to_socket(req->sockfd, msg, strlen(msg));
		return;
	}

	sockfd = socket(AF_INET, SOCK_STREAM, 0);
	if(sockfd < 1) {
		msg = "Socket Error\n";
		send_to_socket(req->sockfd, msg, strlen(msg));
		return;
	}

	bzero(&servaddr, sizeof(struct sockaddr_in));
	servaddr.sin_family = AF_INET;
	servaddr.sin_port = htons(80);
	memcpy(&servaddr.sin_addr, servhost->h_addr_list[0], servhost->h_length);

	bzero(line, 1024);
	char ip_str[16];
	snprintf(line, 1024, "IP: %s\n", inet_ntop(AF_INET, &servaddr.sin_addr, ip_str, 16));
	send_to_socket(req->sockfd, line, strlen(line));


	if(connect(sockfd, (struct sockaddr *) &servaddr, sizeof(struct sockaddr_in)) < 0) {
		msg = "Connect error\n";
		send_to_socket(req->sockfd, msg, strlen(msg));
		return;
	}


	/* ask for the website */
	msg = "GET www.cs.stanford.edu HTTP/1.0\n\n";
	if(write(sockfd, msg, strlen(msg)) < 0) {
		msg = "Write error\n";
		send_to_socket(req->sockfd, msg, strlen(msg));
		return;
	}

	/* retrieve the website */
	bzero(line, 1024);
	error = read(sockfd, line, 1024);
	while(error > 0) {

		error = write(req->sockfd, line, strlen(line));
		if(error < 0) {
			msg = "Write error\n";
			send_to_socket(req->sockfd, msg, strlen(msg));
			return;
		}

		error = read(sockfd, line, 1024);
		if(error < 0) {
			msg = "Read error\n";
			send_to_socket(req->sockfd, msg, strlen(msg));
			return;
		}
	}
	send_to_socket(req->sockfd, "\n\n", 2);
}
Esempio n. 30
0
/*
 * CLI help for general usage functions
 */
void cli_help(router_state* rs, cli_request* req) {

	char *usage = "usage: <args>\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\tshow vns [user server vhost lhost topology]\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\tshow ip [route interface arp]\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\tip [route interface arp]\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\tsping [dest]\n";
	send_to_socket(req->sockfd, usage, strlen(usage));


	/* PWOSPF */

	usage = "\tshow pwopsf [iface router info]\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\tset aid [area id]\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\tset hello interval [interval]\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\tset lsu broadcast [on off]\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\tset lsu interval [interval]\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\tsend hello\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\tsend lsu\n";
	send_to_socket(req->sockfd, usage, strlen(usage));



	/* HARDWARE */

	usage = "\tshow hw rtable\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\tshow hw arp\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\tshow hw iface\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\thw iface add [eth0 eth1 eth2 eth3] [mac adress]\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\thw iface del [eth0 eth1 eth2 eth3]\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\tnuke arp\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\tnuke hw arp [row]\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\thw iface [eth0 eth1 eth2 eth3] up\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\thw iface [eth0 eth1 eth2 eth3] down\n";
	send_to_socket(req->sockfd, usage, strlen(usage));

	usage = "\thw packts fwd\n";
	send_to_socket(req->sockfd, usage, strlen(usage));



}