connect_action=newKAction(i18n("Connect to Server"),"connect_creating",KShortcut(),TQT_TQOBJECT(this),TQT_SLOT(connectToServer()),ac,"connect_server");
connect_action=newKAction(i18n("Connect to Server"),"connect_creating",KShortcut(),TQT_TQOBJECT(this),TQT_SLOT(connectToServer()),ac,"connect_server");
disconnect_action=newKAction(i18n("Disconnect from Server"),"connect_no",KShortcut(),TQT_TQOBJECT(this),TQT_SLOT(disconnectFromServer()),ac,"disconnect_server");
disconnect_action=newKAction(i18n("Disconnect from Server"),"connect_no",KShortcut(),TQT_TQOBJECT(this),TQT_SLOT(disconnectFromServer()),ac,"disconnect_server");
KMessageBox::error(this,i18n("<qt>No stations of the specified type are currently available<p>Please try again later</qt>"),i18n("Insufficient Laboratory Resources"));
KMessageBox::error(this,i18n("<qt>No stations of the specified type are currently available<p>Please try again later</qt>"),i18n("Insufficient Laboratory Resources"));
disconnectFromServer();
disconnectFromServer();
}
}
elseif(result=="ERRPREVCN"){
KMessageBox::error(this,i18n("<qt>You are already connected to a laboratory station<p>Please disconnect and try again</qt>"),i18n("Multiple Connections Detected"));
disconnectFromServer();
}
else{
else{
KMessageBox::error(this,i18n("<qt>Unknown server error<p>Please reconnect and try again</qt>"),i18n("Internal Error"));
KMessageBox::error(this,i18n("<qt>Unknown server error<p>Please reconnect and try again</qt>"),i18n("Internal Error"));
KMessageBox::error(this,i18n("TDE could not find the %1 part, or it could not be started. Did you 'make install'?").arg(m_libraryName));
KMessageBox::error(this,i18n("TDE could not find the %1 Part, or the Remote Laboratory Communications Analyzer Part could not be started. Did you make install?").arg(m_libraryName));
@ -133,13 +155,54 @@ int FPGAViewPart::connectToServer(TQString server) {
KMessageBox::error(0,i18n("<qt>Unable to establish Kerberos protocol with remote server<p>Please verify that you currently hold a valid Kerberos ticket</qt>"),i18n("Connection Failed"));
KMessageBox::error(0,i18n("<qt>Unable to establish Kerberos protocol with remote server<p>Please verify that you currently hold a valid Kerberos ticket</qt>"),i18n("Connection Failed"));
// Read magic number and proto version from server
// How do we know which service to request?
TQ_UINT32magicnum;
// ds << TQString("SERV");
TQ_UINT32protover;
// ds <<
ds>>magicnum;
ds>>protover;
printf("[DEBUG] Got magic number %d and protocol version %d\n\r",magicnum,protover);fflush(stdout);
// Request connection to backend server
ds<<TQString("SERV");
ds<<TQString(CLIENT_LIBRARY);
ds>>response;
printf("[RAJA DEBUG 400.0] Got '%s' from the server\n\r",response.ascii());fflush(stdout);
if(response=="OK"){
m_connectionMutex->unlock();
return0;
}
elseif(response=="ERRNOCONN"){
KMessageBox::error(0,i18n("<qt>Unable to establish connection with backend server<p>Please verify that you are currently connected to a workspace</qt>"),i18n("Connection Failed"));
m_connectionMutex->unlock();
return-1;
}
elseif(response=="ERRNOTAVL"){
KMessageBox::error(0,i18n("<qt>The backend server is not available at this time<p>Please try a different workspace, or try again later</qt>"),i18n("Connection Failed"));
m_connectionMutex->unlock();
return-1;
}
elseif(response=="ERRNOSERV"){
KMessageBox::error(0,i18n("<qt>The active laboratory workspace does not support the requested service</qt>"),i18n("Service Unavailable"));
m_connectionMutex->unlock();
return-1;
}
else{
KMessageBox::error(0,i18n("<qt>Unable to establish connection with remote server</qt>"),i18n("Connection Failed"));
@ -28,7 +28,7 @@ The client may terminate the connection at any time, or provide invalid data to
After initial negotiation, the server must enter command mode. In this mode the server expects to receive a command string. The following commands are currently supported:
After initial negotiation, the server must enter command mode. In this mode the server expects to receive a command string. The following commands are currently supported:
LIST
LIST
BIND <StationType 'Type ID'>
BIND <StationType 'Type ID'>
SERV <ServiceType 'Service ID'>
SERV <TQString 'Client Library Name'>
QUIT
QUIT
If an invalid command is specified, the server should respond with a string containing the case-sensitive text "ERRINVCMD".
If an invalid command is specified, the server should respond with a string containing the case-sensitive text "ERRINVCMD".
@ -44,17 +44,17 @@ Descriptions should be constructed from station service type flags as known to t
BIND <StationType 'Type ID'>:
BIND <StationType 'Type ID'>:
Connects to a specified laboratory station
Connects to a specified laboratory station
If a station with the specified Service ID list is available, the server must mark that station as in use by the authenticated user, must return the case-sensitive text "OK", and should block all commands other than QUIT. If a station with the specified Service ID list is not available, the server must respond with a string containing the case-sensitive text "ERRUNAVAL" and must re-enter command mode.
If a station with the specified Service ID list is available, the server must mark that station as in use by the authenticated user, must return the case-sensitive text "OK", and should block all commands other than QUIT. If a station with the specified Service ID list is not available, the server must respond with a string containing the case-sensitive text "ERRUNAVAL" and must re-enter command mode. If the specified user is already connected to a laboratory station, the server must return the case-sensitive text "ERRPREVCN", and should block all commands other than QUIT.
Example: BIND
Example: BIND
StationType
StationType
SERV <TQ_UINT32 'Service ID'>
SERV <TQString 'Client Library Name'>
Requests a connection to the specified backend server on the laboratory station
Requests a connection to the specified backend server on the laboratory station
If BIND was previously commanded on this connection, the server must respond with a string containing the case-sensitive text "ERRINVCMD". If no station has been reserved for this user via a call to BIND on an active connection, the server must respond with a string containing the case-sensitive text "ERRNOCONN". If the backend server is not available, i.e. a connection attempt or attempts have failed to establish a connection, the server should respond with the string "ERRNOTAVL" and must close the client connection. Otherwise, the server must return a string containing the case-sensitive text "OK" and then immediately enter binary pass-through mode between the backend server and the client.
If BIND was previously commanded on this connection, the server must respond with a string containing the case-sensitive text "ERRINVCMD". If no station has been reserved for this user via a call to BIND on an active connection, the server must respond with a string containing the case-sensitive text "ERRNOCONN". If the backend server is not available, i.e. a connection attempt or attempts have failed to establish a connection, the server should respond with the string "ERRNOTAVL" and must close the client connection. If the backend service is not available in the active laboratory workspace, the server should respond with the string "ERRNOSERV" and must close the client connection. Otherwise, the server must return a string containing the case-sensitive text "OK" and then immediately enter binary pass-through mode between the backend server and the client.
@ -253,18 +284,55 @@ int AuthSocket::enterCommandLoop() {
printf("[DEBUG] Connection failed to %s:%d for user %s@%s due to Kerberos failure\n\r",serviceHostName.ascii(),servicePort,m_authenticatedUserName.ascii(),m_authenticatedRealmName.ascii());fflush(stdout);
printf("[DEBUG] Connection failed to %s:%d for user %s@%s due to Kerberos failure\n\r",serviceHostName.ascii(),servicePort,m_authenticatedUserName.ascii(),m_authenticatedRealmName.ascii());fflush(stdout);
printf("[DEBUG] Connection failed to %s:%d for user %s@%s\n\r",serviceHostName.ascii(),servicePort,m_authenticatedUserName.ascii(),m_authenticatedRealmName.ascii());fflush(stdout);
printf("[DEBUG] Connection failed to %s:%d for user %s@%s due to remote server returning %s\n\r",serviceHostName.ascii(),servicePort,m_authenticatedUserName.ascii(),m_authenticatedRealmName.ascii(),server_reply.ascii());fflush(stdout);
}
}
}
}
}
else{
else{
clientSocket.close();
ds<<TQString("ERRNOTAVL");
ds<<TQString("ERRNOTAVL");
printf("[DEBUG] Connection failed to %s:%d for user %s@%s\n\r",serviceHostName.ascii(),servicePort,m_authenticatedUserName.ascii(),m_authenticatedRealmName.ascii());fflush(stdout);