Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] [ndt] r779 committed - Moving constants relating to logging out of web100srv.h, differentiati...

Subject: NDT-DEV email list created

List archive

[ndt-dev] [ndt] r779 committed - Moving constants relating to logging out of web100srv.h, differentiati...


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt-dev] [ndt] r779 committed - Moving constants relating to logging out of web100srv.h, differentiati...
  • Date: Mon, 13 Aug 2012 17:49:58 +0000

Revision: 779
Author:

Date: Mon Aug 13 10:49:28 2012
Log: Moving constants relating to logging out of web100srv.h, differentiating protocol and log file dirs more cleanly, bumping release num
http://code.google.com/p/ndt/source/detail?r=779

Modified:
/trunk/Applet/NDTConstants.java
/trunk/configure.ac
/trunk/src/logging.c
/trunk/src/logging.h
/trunk/src/web100-pcap.c
/trunk/src/web100clt.c
/trunk/src/web100srv.c
/trunk/src/web100srv.h

=======================================
--- /trunk/Applet/NDTConstants.java Wed Aug 8 13:32:32 2012
+++ /trunk/Applet/NDTConstants.java Mon Aug 13 10:49:28 2012
@@ -23,7 +23,7 @@
* TODO for a later release: Version could be moved to some
"configurable"
* or "property" area instead of being in code that needs compilation.
*/
- public static final String VERSION = "3.6.5.1";
+ public static final String VERSION = "3.6.5.2";

public static final String NDT_TITLE_STR = "TCP/Web100 Network Diagnostic Tool v";

=======================================
--- /trunk/configure.ac Wed Aug 8 13:32:32 2012
+++ /trunk/configure.ac Mon Aug 13 10:49:28 2012
@@ -29,7 +29,7 @@
# Process this file with autoconf to produce a configure script.
#
# AC_PREREQ(2.57)
-AC_INIT([NDT],[3.6.5.1],[])
+AC_INIT([NDT],[3.6.5.2],[])
AC_CONFIG_AUX_DIR(config)
# AM_INIT_AUTOMAKE(NDT, v1.0, [no-define])
AM_INIT_AUTOMAKE
=======================================
--- /trunk/src/logging.c Wed Aug 1 12:29:37 2012
+++ /trunk/src/logging.c Mon Aug 13 10:49:28 2012
@@ -20,7 +20,7 @@
/* #endif */

#include "logging.h"
-#include "testoptions.h"
+/* #include "testoptions.h" */
#include "strlutils.h"
#include "utils.h"
#include "protocol.h"
@@ -226,6 +226,32 @@
log_println(5," Protocol file location=%s;\n", ProtocolLogDirName);
return ProtocolLogDirName;
}
+
+/**
+ * Check if protocol logging is enabled
+ * @return is protocol logging enabled?
+ */
+char get_protocolloggingenabled() {
+ return enableprotologging;
+}
+
+/**
+ * Create protocol log directory.
+ * The directory is specified by using option --protocollogdir.
+ * If not specified, this is the same directory as the
+ * one in which the snap/TCPTrace files are saved
+ * @param none
+ */
+void create_protolog_dir() {
+ if ( get_protocolloggingenabled() ) {
+ set_timestamp();
+ sprintf(protocollogfilestore, "%s/", get_protologdir());
+ log_println(5,"Creating protocol log directory=%s", protocollogfilestore);
+ create_named_logdir(protocollogfilestore, sizeof(protocollogfilestore), "", get_protocolloggingenabled());
+ set_protologdir(protocollogfilestore);
+ log_println(9,"DataDir remains=%s", DataDirName);
+ }
+}

/**
* This method is no longer needed since the protocol log file name
@@ -251,7 +277,7 @@

strlcpy(ProtocolLogFileName, protologlocalarr, sizeof(ProtocolLogFileName));

- log_println(0, "Protocol filename: %s: %s\n", ProtocolLogFileName,
+ log_println(5, "Protocol filename: %s: %s\n", ProtocolLogFileName,
ProtocolLogDirName);

}
@@ -783,7 +809,6 @@

struct tm *result;
time_t now;
-
setenv("TZ", "UTC", 0);
now = get_timestamp();
result = gmtime(&now);
@@ -1070,18 +1095,21 @@
* @param direnamedestarg location to store final directory name
* @param destnamearrsize Size of dest name string
* @param finalsuffix string constant suffix (C2S/S2C IP:port.ndttrace etc)
- *
+ * @param isProtoLog Is this the protocol log directory?
*
*/
void create_named_logdir(char *dirnamedestarg, int destnamearrsize,
- char *finalsuffix) {
+ char *finalsuffix, char isProtoLog) {

//char namebuf[256];
//size_t namebuflen = 255;
char dir[128];
DIR *dp;
-
- strlcpy(dirnamedestarg, DataDirName, destnamearrsize);
+ if ( !isProtoLog ) {
+ strlcpy(dirnamedestarg, DataDirName, destnamearrsize);
+ strlcat(dirnamedestarg, "/", destnamearrsize);
+ log_println(5, "DirNAME=%s", DataDirName);
+ }
if ((dp = opendir(dirnamedestarg)) == NULL && errno == ENOENT)
mkdir(dirnamedestarg, 0755);
closedir(dp);
@@ -1111,7 +1139,7 @@
strlcat(dirnamedestarg, "/", destnamearrsize);
sprintf(dir, "%s", finalsuffix);
strlcat(dirnamedestarg, dir, destnamearrsize);
- log_println(0, "end named_log_create %s", dirnamedestarg);
+ log_println(5, "end named_log_create %s", dirnamedestarg);
}

/** Create directories for snap/tcp trace log files, and meta files.
@@ -1145,7 +1173,7 @@
socketaddrport, finalsuffix);
strlcpy(finalsuffix, dir, finalsuffixsize);

- create_named_logdir(dirnamedestarg, destnamearrsize, finalsuffix);
+ create_named_logdir(dirnamedestarg, destnamearrsize, finalsuffix, 0);

I2AddrFree(sockAddr);

=======================================
--- /trunk/src/logging.h Mon Apr 30 13:46:39 2012
+++ /trunk/src/logging.h Mon Aug 13 10:49:28 2012
@@ -15,11 +15,14 @@
#include <sys/types.h>
#include "ndtptestconstants.h"
#include "runningtest.h" // protocol validation
+#define LOG_FACILITY LOG_LOCAL0 /* Syslog facility to log at */
+#define LOGDIR "serverdata" /* directory for detailed snaplog and tcpdump files */
#define LOGFILE "web100srv.log" /* Name of log file */
#define PROTOLOGFILE "web100srvprotocol.log" /* Name of protocol validation log file */
#define PROTOLOGPREFIX "web100srvprotocol_" /* prefix for protocol validation log file */
#define PROTOLOGSUFFIX ".log" /* suffix for protocol validation log file */
-#define FILENAME_SIZE 256 // This could have been in utils.h, but will be used immediately here
+#define FILENAME_SIZE 256 /* This could have been in utils.h, but will be used immediately here */
+/* #define PROTOLOGDIR "protocollog" Protocol log dir */
void log_init(char* progname, int debuglvl);
void set_debuglvl(int debuglvl);
void set_logfile(char* filename);
@@ -86,7 +89,7 @@
void enableprotocollogging();
char *createprotologfilename(char* client_ip, char* textappendarg);
void create_named_logdir(char *dirnamedestarg, int destnamearrsize,
- char *finalsuffix);
+ char *finalsuffix, char isProtoLog);
void create_client_logdir(struct sockaddr *cliaddrarg, socklen_t clilenarg,
char *dirnamedestarg, int destnamearrsize, char *finalsuffix,
int finalsuffixsize);
@@ -103,6 +106,8 @@
enum PROCESS_TYPE_INT procidarg, enum PROCESS_STATUS_INT teststatusarg, int socketnum);
void protolog_procstatuslog(int pid, enum TEST_ID testidarg,
enum PROCESS_TYPE_INT procidarg, enum PROCESS_STATUS_INT teststatusarg, int socketnum);
+char get_protocolloggingenabled();
+void create_protolog_dir();

struct metadata meta;
#endif
=======================================
--- /trunk/src/web100-pcap.c Mon Apr 30 13:46:39 2012
+++ /trunk/src/web100-pcap.c Mon Aug 13 10:49:28 2012
@@ -977,7 +977,7 @@
sprintf(dir, "%s_%s:%d.%s_ndttrace",
get_ISOtime(isoTime, sizeof(isoTime)),
namebuf,
I2AddrPort(sockAddr), direction);
- create_named_logdir(logdir, sizeof(logdir), dir);
+ create_named_logdir(logdir, sizeof(logdir), dir, 0);
pdump = pcap_dump_open(pd, logdir);
fprintf(stderr, "Opening '%s' log fine\n", logdir);
if (pdump == NULL) {
=======================================
--- /trunk/src/web100clt.c Wed Aug 1 12:29:37 2012
+++ /trunk/src/web100clt.c Mon Aug 13 10:49:28 2012
@@ -44,7 +44,6 @@
double loss, estimate, avgrtt, spd, waitsec, timesec, rttsec;
double order, rwintime, sendtime, cwndtime, rwin, swin, cwin;
double mylink;
-
static struct option long_options[] = { { "name", 1, 0, 'n' }, { "port", 1, 0,
'p' }, { "debug", 0, 0, 'd' }, { "help", 0, 0, 'h' }, {
"msglvl", 0, 0,
'l' }, { "web100variables", 0, 0, 301 }, {
"buffer", 1, 0, 'b' }, {
@@ -483,7 +482,6 @@
I2Addr server_addr = NULL;
I2Addr local_addr = NULL, remote_addr = NULL;
char* ptr;
-
#ifdef AF_INET6
#define GETOPT_LONG_INET6(x) "46"x
#else
@@ -554,6 +552,9 @@
short_usage(argv[0], "Unrecognized non-option elements");
}

+ // If protocol log is enabled, create log dir
+ create_protolog_dir();
+
log_init(argv[0], debug);

failed = 0;
=======================================
--- /trunk/src/web100srv.c Wed Aug 1 12:29:37 2012
+++ /trunk/src/web100srv.c Mon Aug 13 10:49:28 2012
@@ -1782,6 +1782,9 @@
sprintf(logd, "%s/%s/", BASEDIR, DataDirName);
DataDirName = logd;
}
+log_println(0,"----DataDirName=%s", DataDirName);
+
+ create_protolog_dir();

if (SysLogFacility != NULL) {
i = 0;
@@ -2630,7 +2633,7 @@
if (cputime) {
sprintf(dir, "%s_%s:%d.cputime", get_ISOtime(isoTime, sizeof(isoTime)), name, testPort);
log_println(8,
"CPUTIME:suffix=%s",dir);
-
create_named_logdir(cputimelog, sizeof(cputimelog),dir);
+
create_named_logdir(cputimelog, sizeof(cputimelog),dir, 0);
memcpy(meta.CPU_time, dir,
strlen(dir));
if (pthread_create(&workerThreadId, NULL, cputimeWorker, (void*) cputimelog)) {
log_println(0, "Cannot create worker thread for writing cpu usage!");
=======================================
--- /trunk/src/web100srv.h Mon Apr 30 13:46:39 2012
+++ /trunk/src/web100srv.h Mon Aug 13 10:49:28 2012
@@ -55,8 +55,10 @@

#define WEB100_VARS 128 /* number of web100 variables you want to access*/
#define WEB100_FILE "web100_variables" /* names of the variables to access*/
-#define LOG_FACILITY LOG_LOCAL0 /* Syslog facility to log at
*/
-#define LOGDIR "serverdata" /* directory for detailed snaplog and tcpdump files */
+/* Move to logging.h
+#define LOG_FACILITY LOG_LOCAL0 // Syslog facility to log at
+#define LOGDIR "serverdata" // directory for detailed snaplog and tcpdump files
+*/

/* Location of default config file */
#define CONFIGFILE "/etc/ndt.conf"


  • [ndt-dev] [ndt] r779 committed - Moving constants relating to logging out of web100srv.h, differentiati..., ndt, 08/13/2012

Archive powered by MHonArc 2.6.16.

Top of Page