2014-06-02 00:14:19 -07:00
|
|
|
#ifndef NETSUKUKUCONSOLE_H
|
|
|
|
#define NETSUKUKUCONSOLE_H
|
|
|
|
|
2014-06-04 19:41:12 -07:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <utmp.h>
|
|
|
|
#include <sys/un.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
2014-09-14 09:50:08 -05:00
|
|
|
|
|
|
|
#define SERVER_PATH "/tmp/ntk-console"
|
|
|
|
#define BUFFER_LENGTH 250
|
|
|
|
#define VERSION_STR "0.0.2"
|
|
|
|
|
|
|
|
#ifndef TRUE
|
|
|
|
#define FALSE 0
|
|
|
|
#define TRUE 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
COMMAND_HELP = 0x100,
|
|
|
|
COMMAND_UPTIME,
|
|
|
|
COMMAND_KILL,
|
|
|
|
COMMAND_VERSION,
|
|
|
|
COMMAND_INETCONN,
|
|
|
|
COMMAND_CURIFS,
|
|
|
|
COMMAND_CURIFSCT,
|
|
|
|
COMMAND_CURQSPNID,
|
|
|
|
COMMAND_CURIP,
|
|
|
|
COMMAND_CURNODE,
|
|
|
|
COMMAND_IFS,
|
|
|
|
COMMAND_IFSCT,
|
|
|
|
COMMAND_QUIT,
|
|
|
|
COMMAND_CONSUPTIME,
|
|
|
|
} command_t;
|
|
|
|
|
2014-06-02 22:06:48 -07:00
|
|
|
|
2014-08-15 22:51:54 -07:00
|
|
|
int sockfd = -1, sockfd1 = -1;
|
2014-06-04 19:41:12 -07:00
|
|
|
struct sockaddr_un serveraddr;
|
2014-08-15 22:51:54 -07:00
|
|
|
int rc, bytesReceived;
|
2014-06-04 19:41:12 -07:00
|
|
|
|
|
|
|
time_t rawtime;
|
|
|
|
struct tm *timeinfo;
|
|
|
|
|
|
|
|
int uptime_sec;
|
|
|
|
int uptime_min;
|
|
|
|
int uptime_hour;
|
|
|
|
int uptime_day;
|
|
|
|
int uptime_month;
|
|
|
|
int uptime_year;
|
|
|
|
|
2014-06-07 04:52:30 -07:00
|
|
|
int i;
|
2014-06-04 19:41:12 -07:00
|
|
|
|
2014-09-14 09:50:08 -05:00
|
|
|
void usage();
|
|
|
|
void clean_up();
|
|
|
|
|
|
|
|
void opensocket();
|
|
|
|
void closesocket();
|
|
|
|
|
|
|
|
|
|
|
|
#endif /*NETSUKUKUCONSOLE_H*/
|