mirror of
https://github.com/ChronosX88/netsukuku.git
synced 2024-11-26 04:02:19 +00:00
ntk-console: Begin returning valid results in ntk-console-server
This commit is contained in:
parent
2694b1cda4
commit
cea41ed409
@ -94,41 +94,48 @@ send_response(int session_fd, char response[CONSOLE_BUFFER_LENGTH], ...)
|
|||||||
static void
|
static void
|
||||||
request_processing(int session_fd, cmd_packet_t packet)
|
request_processing(int session_fd, cmd_packet_t packet)
|
||||||
{
|
{
|
||||||
|
char buffer[CONSOLE_BUFFER_LENGTH];
|
||||||
|
int maxBuffer = CONSOLE_BUFFER_LENGTH - 1;
|
||||||
|
|
||||||
switch (packet.command) {
|
switch (packet.command) {
|
||||||
case COMMAND_UPTIME:
|
case COMMAND_UPTIME:
|
||||||
send_response(session_fd, (char)time(0)-me.uptime);
|
{
|
||||||
break;
|
int uptime = time(0) - me.uptime;
|
||||||
case COMMAND_VERSION:
|
snprintf(buffer, maxBuffer, "node uptime: %d seconds", uptime);
|
||||||
send_response(session_fd, VERSION_STR);
|
|
||||||
break;
|
|
||||||
case COMMAND_CURIFS:
|
|
||||||
send_response(session_fd, (char)me.cur_ifs);
|
|
||||||
break;
|
|
||||||
case COMMAND_CURIFSCT:
|
|
||||||
send_response(session_fd, (char)me.cur_ifs_n);
|
|
||||||
break;
|
|
||||||
case COMMAND_INETCONN:
|
|
||||||
send_response(session_fd, (char)me.inet_connected);
|
|
||||||
break;
|
|
||||||
case COMMAND_CURQSPNID:
|
|
||||||
send_response(session_fd, (char)me.cur_qspn_id);
|
|
||||||
break;
|
|
||||||
case COMMAND_CURIP:
|
|
||||||
send_response(session_fd, (char)me.cur_ip.data);
|
|
||||||
break;
|
|
||||||
case COMMAND_CURNODE:
|
|
||||||
send_response(session_fd, (char)me.cur_node);
|
|
||||||
break;
|
|
||||||
case COMMAND_IFS:
|
|
||||||
send_response(session_fd, "IFS: TODO");
|
|
||||||
break;
|
|
||||||
case COMMAND_IFSCT:
|
|
||||||
send_response(session_fd, "IFS: TODO");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
send_response(session_fd, "Provided command is invalid or yet to be implemented.");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case COMMAND_VERSION:
|
||||||
|
snprintf(buffer, maxBuffer, "ntkd version: %s", VERSION_STR);
|
||||||
|
break;
|
||||||
|
case COMMAND_CURIFS:
|
||||||
|
//send_response(session_fd, (char)me.cur_ifs);
|
||||||
|
break;
|
||||||
|
case COMMAND_CURIFSCT:
|
||||||
|
snprintf(buffer, maxBuffer, "current interface count: %d", me.cur_ifs_n);
|
||||||
|
break;
|
||||||
|
case COMMAND_INETCONN:
|
||||||
|
//send_response(session_fd, (char)me.inet_connected);
|
||||||
|
break;
|
||||||
|
case COMMAND_CURQSPNID:
|
||||||
|
//send_response(session_fd, (char)me.cur_qspn_id);
|
||||||
|
break;
|
||||||
|
case COMMAND_CURIP:
|
||||||
|
//send_response(session_fd, (char)me.cur_ip.data);
|
||||||
|
break;
|
||||||
|
case COMMAND_CURNODE:
|
||||||
|
//send_response(session_fd, (char)me.cur_node);
|
||||||
|
break;
|
||||||
|
case COMMAND_IFS:
|
||||||
|
//send_response(session_fd, "IFS: TODO");
|
||||||
|
break;
|
||||||
|
case COMMAND_IFSCT:
|
||||||
|
//send_response(session_fd, "IFS: TODO");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
snprintf(buffer, maxBuffer, "Provided command is invalid or not implemented in this API");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
send_response(session_fd, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ ntkd_request(command_t command)
|
|||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Response: '%s'\n", response);
|
printf("%s\n", response);
|
||||||
free(response);
|
free(response);
|
||||||
closesocket();
|
closesocket();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user