diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-09-19 12:50:53 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-09-19 12:50:53 -0500 |
commit | 851d4c9bea54059b375cc6b90b08887bc2ed3e25 (patch) | |
tree | 0f39f5dd776c5fee9eee62b8e599d5806c43f32b /servers | |
parent | 9178fa8161fa97247a4b660e0eaa5c1a763969d6 (diff) | |
download | ulab-851d4c9bea54059b375cc6b90b08887bc2ed3e25.tar.gz ulab-851d4c9bea54059b375cc6b90b08887bc2ed3e25.zip |
Add administration console
Diffstat (limited to 'servers')
-rw-r--r-- | servers/admin_sys_ctl_server_lin/src/admin_sys_ctl.cpp | 101 | ||||
-rw-r--r-- | servers/admin_sys_ctl_server_lin/src/main.cpp | 2 | ||||
-rw-r--r-- | servers/fpga_programming_server_lin/src/fpga_conn.cpp | 2 | ||||
-rw-r--r-- | servers/fpga_server_lin/src/fpga_conn.cpp | 2 | ||||
-rw-r--r-- | servers/gpib_server_lin/src/gpib_conn.cpp | 2 | ||||
-rw-r--r-- | servers/sensor_monitor_server_lin/src/sensor_conn.cpp | 2 |
6 files changed, 70 insertions, 41 deletions
diff --git a/servers/admin_sys_ctl_server_lin/src/admin_sys_ctl.cpp b/servers/admin_sys_ctl_server_lin/src/admin_sys_ctl.cpp index f0cf958..7418de1 100644 --- a/servers/admin_sys_ctl_server_lin/src/admin_sys_ctl.cpp +++ b/servers/admin_sys_ctl_server_lin/src/admin_sys_ctl.cpp @@ -137,7 +137,7 @@ void SysCtlSocket::finishKerberosHandshake() { masterRealm = "(NULL)"; } if ((m_authenticatedUserName != masterUser) || (m_authenticatedRealmName != masterRealm)) { - printf("[DEBUG] Connection from %s closed due to authentication failure (attempted connection as user %s@%s)\n\r", m_remoteHost.ascii(), masterUser.ascii(), masterRealm.ascii()); + printf("[DEBUG] Connection from %s closed due to authentication failure (attempted connection as user %s@%s)\n\r", m_remoteHost.ascii(), m_authenticatedUserName.ascii(), m_authenticatedRealmName.ascii()); close(); return; } @@ -182,48 +182,56 @@ void SysCtlSocket::commandLoop() { if (subCommand == "TERMINALS") { clearFrameTail(); ds << TQString("OK"); - writeEndOfFrame(); + TerminalServiceStatusList list; TQSqlCursor databaseActivityCursor("sessions", TRUE, m_terminals_database); databaseActivityCursor.select(); while (databaseActivityCursor.next()) { - TQ_UINT32 protocolVersion = 1; - TQDateTime loginStamp; - TQDateTime activityStamp; - loginStamp.setTime_t(databaseActivityCursor.value("stamp_start").toInt()); - activityStamp.setTime_t(databaseActivityCursor.value("stamp_statechange").toInt()); - - ds << protocolVersion; - ds << databaseActivityCursor.value("pk").toInt(); - ds << databaseActivityCursor.value("username").toString(); - ds << databaseActivityCursor.value("servername").toString(); - ds << databaseActivityCursor.value("server_pid").toInt(); - ds << databaseActivityCursor.value("wm_pid").toInt(); - ds << databaseActivityCursor.value("state").toInt(); - ds << databaseActivityCursor.value("display").toInt(); - ds << loginStamp; - ds << activityStamp; + TerminalServiceStatusType status; + + status.protocolVersion = 1; + status.sessionID = databaseActivityCursor.value("pk").toInt(); + status.username = databaseActivityCursor.value("username").toString(); + status.serverName = databaseActivityCursor.value("servername").toString(); + status.serverPID = databaseActivityCursor.value("server_pid").toInt(); + status.wmPID = databaseActivityCursor.value("wm_pid").toInt(); + status.state = databaseActivityCursor.value("state").toInt(); + status.display = databaseActivityCursor.value("display").toInt(); + status.loginStamp.setTime_t(databaseActivityCursor.value("stamp_start").toLongLong()); + status.activityStamp.setTime_t(databaseActivityCursor.value("stamp_statechange").toLongLong()); + + list.append(status); } + ds << list; writeEndOfFrame(); } else if (subCommand == "WORKSPACES") { clearFrameTail(); ds << TQString("OK"); - writeEndOfFrame(); + WorkspaceServiceStatusList list; TQSqlCursor databaseActivityCursor("activity", TRUE, m_workspaces_database); databaseActivityCursor.select(); while (databaseActivityCursor.next()) { - TQ_UINT32 protocolVersion = 1; - TQDateTime loginStamp; - loginStamp.setTime_t(databaseActivityCursor.value("logontime").toInt()); - - ds << protocolVersion; - ds << databaseActivityCursor.value("pk").toInt(); - ds << databaseActivityCursor.value("station").toInt(); - ds << databaseActivityCursor.value("username").toString(); - ds << databaseActivityCursor.value("realmname").toString(); - ds << databaseActivityCursor.value("serverid").toInt(); - ds << loginStamp; + WorkspaceServiceStatusType status; + + status.protocolVersion = 1; + status.sessionID = databaseActivityCursor.value("pk").toInt(); + status.stationID = databaseActivityCursor.value("station").toInt(); + status.username = databaseActivityCursor.value("username").toString(); + status.realmname = databaseActivityCursor.value("realmname").toString(); + status.serverID = databaseActivityCursor.value("serverid").toInt(); + status.serviceID = databaseActivityCursor.value("serviceid").toInt(); + status.stationID = databaseActivityCursor.value("station").toInt(); + TQSqlCursor databaseStationsCursor("stations", TRUE, m_workspaces_database); + databaseStationsCursor.select(TQString("pk=%1").arg(status.stationID)); + if (databaseStationsCursor.next()) { + status.stationName = databaseStationsCursor.value("name").toString(); + } + status.loginStamp.setTime_t(databaseActivityCursor.value("logontime").toLongLong()); + status.terminateStamp.setTime_t(databaseActivityCursor.value("terminate").toLongLong()); + + list.append(status); } + ds << list; writeEndOfFrame(); } else { @@ -281,19 +289,40 @@ void SysCtlSocket::commandLoop() { writeEndOfFrame(); } else if (subCommand == "KILL_WORKSPACE") { + TQ_INT32 terminationOffset; + ds >> terminationOffset; clearFrameTail(); + TQDateTime terminationTime = TQDateTime::currentDateTime(); + terminationTime = terminationTime.addSecs(terminationOffset*60); TQSqlCursor databaseActivityCursor("activity", TRUE, m_workspaces_database); databaseActivityCursor.select(TQString("pk=%1").arg(sessionID)); if (databaseActivityCursor.next()) { - databaseActivityCursor.select(TQString("pk=%1").arg(sessionID)); - if (databaseActivityCursor.next()) { - TQSqlRecord *buffer = databaseActivityCursor.primeUpdate(); - buffer->setValue("terminate", true); - databaseActivityCursor.update(); + TQSqlRecord *buffer = databaseActivityCursor.primeUpdate(); + if (terminationOffset > -2) { + buffer->setValue("terminate", terminationTime.toTime_t()); + } + else { + buffer->setValue("terminate", 0); } + databaseActivityCursor.update(); + + ds << TQString("OK"); + } + else { + ds << TQString("ERRINVCMD"); + } + writeEndOfFrame(); + } + else if (subCommand == "CANCEL_KILL_WORKSPACE") { + clearFrameTail(); + TQSqlCursor databaseActivityCursor("activity", TRUE, m_workspaces_database); + databaseActivityCursor.select(TQString("pk=%1").arg(sessionID)); + if (databaseActivityCursor.next()) { + TQSqlRecord *buffer = databaseActivityCursor.primeUpdate(); + buffer->setValue("terminate", 0); + databaseActivityCursor.update(); ds << TQString("OK"); - writeEndOfFrame(); } else { ds << TQString("ERRINVCMD"); diff --git a/servers/admin_sys_ctl_server_lin/src/main.cpp b/servers/admin_sys_ctl_server_lin/src/main.cpp index 5d793eb..aa2a661 100644 --- a/servers/admin_sys_ctl_server_lin/src/main.cpp +++ b/servers/admin_sys_ctl_server_lin/src/main.cpp @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) KStartupInfo::appStarted(); - KSimpleConfig config(TQDir::currentDirPath() + "/remotefpga_adminsysctlserver.conf", false); + KSimpleConfig config("remotefpga_adminsysctlserver.conf", false); config.setGroup("Server"); SysCtlServer fpgasvr(0, config.readNumEntry("port", 4015), &config); return app.exec(); diff --git a/servers/fpga_programming_server_lin/src/fpga_conn.cpp b/servers/fpga_programming_server_lin/src/fpga_conn.cpp index 406c76c..cd8ed0b 100644 --- a/servers/fpga_programming_server_lin/src/fpga_conn.cpp +++ b/servers/fpga_programming_server_lin/src/fpga_conn.cpp @@ -139,7 +139,7 @@ void FPGASocket::finishKerberosHandshake() { masterRealm = "(NULL)"; } if ((m_authenticatedUserName != masterUser) || (m_authenticatedRealmName != masterRealm)) { - printf("[DEBUG] Connection from %s closed due to authentication failure (attempted connection as user %s@%s)\n\r", m_remoteHost.ascii(), masterUser.ascii(), masterRealm.ascii()); + printf("[DEBUG] Connection from %s closed due to authentication failure (attempted connection as user %s@%s)\n\r", m_remoteHost.ascii(), m_authenticatedUserName.ascii(), m_authenticatedRealmName.ascii()); close(); return; } diff --git a/servers/fpga_server_lin/src/fpga_conn.cpp b/servers/fpga_server_lin/src/fpga_conn.cpp index 2fc2537..ea5c477 100644 --- a/servers/fpga_server_lin/src/fpga_conn.cpp +++ b/servers/fpga_server_lin/src/fpga_conn.cpp @@ -118,7 +118,7 @@ void FPGASocket::finishKerberosHandshake() { masterRealm = "(NULL)"; } if ((m_authenticatedUserName != masterUser) || (m_authenticatedRealmName != masterRealm)) { - printf("[DEBUG] Connection from %s closed due to authentication failure (attempted connection as user %s@%s)\n\r", m_remoteHost.ascii(), masterUser.ascii(), masterRealm.ascii()); + printf("[DEBUG] Connection from %s closed due to authentication failure (attempted connection as user %s@%s)\n\r", m_remoteHost.ascii(), m_authenticatedUserName.ascii(), m_authenticatedRealmName.ascii()); close(); return; } diff --git a/servers/gpib_server_lin/src/gpib_conn.cpp b/servers/gpib_server_lin/src/gpib_conn.cpp index 6f20316..34e5300 100644 --- a/servers/gpib_server_lin/src/gpib_conn.cpp +++ b/servers/gpib_server_lin/src/gpib_conn.cpp @@ -137,7 +137,7 @@ void GPIBSocket::finishKerberosHandshake() { masterRealm = "(NULL)"; } if ((m_authenticatedUserName != masterUser) || (m_authenticatedRealmName != masterRealm)) { - printf("[DEBUG] Connection from %s closed due to authentication failure (attempted connection as user %s@%s)\n\r", m_remoteHost.ascii(), masterUser.ascii(), masterRealm.ascii()); + printf("[DEBUG] Connection from %s closed due to authentication failure (attempted connection as user %s@%s)\n\r", m_remoteHost.ascii(), m_authenticatedUserName.ascii(), m_authenticatedRealmName.ascii()); close(); return; } diff --git a/servers/sensor_monitor_server_lin/src/sensor_conn.cpp b/servers/sensor_monitor_server_lin/src/sensor_conn.cpp index 60a42c9..e9298db 100644 --- a/servers/sensor_monitor_server_lin/src/sensor_conn.cpp +++ b/servers/sensor_monitor_server_lin/src/sensor_conn.cpp @@ -147,7 +147,7 @@ void SensorSocket::finishKerberosHandshake() { masterRealm = "(NULL)"; } if ((m_authenticatedUserName != masterUser) || (m_authenticatedRealmName != masterRealm)) { - printf("[DEBUG] Connection from %s closed due to authentication failure (attempted connection as user %s@%s)\n\r", m_remoteHost.ascii(), masterUser.ascii(), masterRealm.ascii()); + printf("[DEBUG] Connection from %s closed due to authentication failure (attempted connection as user %s@%s)\n\r", m_remoteHost.ascii(), m_authenticatedUserName.ascii(), m_authenticatedRealmName.ascii()); close(); return; } |