Beispiel #1
0
void playBell(int* IDbell, unsigned char delay)
{
    printf("on \n");
    setChannelState(*IDbell, 1);
    sleep(delay);
    printf("off \n");
    setChannelState(*IDbell, 0);
    sleep(1);
}
Beispiel #2
0
void playMessaCenno(int* IDbell, int duration)
{
    printf("on \n");
    setChannelState(*IDbell, 1);

    sleep(duration);

    printf("off \n");
    setChannelState(*IDbell, 0);

}
Beispiel #3
0
void buzz(int* IDbuzzer){
	int j,k,z=0; 
	for (j=0;j<20;j++){
		setChannelState(*IDbuzzer,1);
		setChannelState(*IDbuzzer,0);
		for (k=0;k<6400;k++){
		      z=1;
		      z=0;
		      }
	}
}
Beispiel #4
0
void playBell(int* IDbell,int* IDbuzzer,unsigned char delay,int *fd){
	printf ("on \n");
	setChannelState(*IDbell,1);
	/*wait(1,&fd);*/

	/*buzzo*/
	buzz(IDbuzzer);

	printf ("off \n");
	setChannelState(*IDbell,0);
	wait(delay,fd);
}
Beispiel #5
0
void playMessa(int* IDbell0, int* IDbell1, int duration)
{
    printf("on \n");
    setChannelState(*IDbell0, 1);
    setChannelState(*IDbell1, 1);

    sleep(duration);

    printf("off \n");
    setChannelState(*IDbell0, 0);
    setChannelState(*IDbell1, 0);

}
Beispiel #6
0
void AbstractSshChannel::closeChannel()
{
    if (m_state == CloseRequested) {
        m_timeoutTimer->stop();
    } else if (m_state != Closed) {
        if (m_state == Inactive) {
            setChannelState(Closed);
        } else {
            setChannelState(CloseRequested);
            m_sendFacility.sendChannelEofPacket(m_remoteChannel);
            m_sendFacility.sendChannelClosePacket(m_remoteChannel);
        }
    }
}
Beispiel #7
0
void AbstractSshChannel::handleOpenSuccess(quint32 remoteChannelId,
    quint32 remoteWindowSize, quint32 remoteMaxPacketSize)
{
    if (m_state != SessionRequested) {
       throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR,
           "Invalid SSH_MSG_CHANNEL_OPEN_CONFIRMATION packet.");
   }
    m_timeoutTimer->stop();

   if (remoteMaxPacketSize < MinMaxPacketSize) {
       throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR,
           "Maximum packet size too low.");
   }

#ifdef CREATOR_SSH_DEBUG
   qDebug("Channel opened. remote channel id: %u, remote window size: %u, "
       "remote max packet size: %u",
       remoteChannelId, remoteWindowSize, remoteMaxPacketSize);
#endif
   m_remoteChannel = remoteChannelId;
   m_remoteWindowSize = remoteWindowSize;
   m_remoteMaxPacketSize = remoteMaxPacketSize - sizeof(quint32) - sizeof m_remoteChannel - 1;
        // Original value includes packet type, channel number and length field for string.
   setChannelState(SessionEstablished);
   handleOpenSuccessInternal();
}
Beispiel #8
0
void AbstractSshChannel::handleOpenSuccess(quint32 remoteChannelId,
    quint32 remoteWindowSize, quint32 remoteMaxPacketSize)
{
    const ChannelState oldState = m_state;
    switch (oldState) {
    case CloseRequested:   // closeChannel() was called while we were in SessionRequested state
    case SessionRequested:
        break; // Ok, continue.
    default:
        throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR,
            "Unexpected SSH_MSG_CHANNEL_OPEN_CONFIRMATION packet.");
    }

    m_timeoutTimer.stop();

   if (remoteMaxPacketSize < MinMaxPacketSize) {
       throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR,
           "Maximum packet size too low.");
   }

#ifdef CREATOR_SSH_DEBUG
   qDebug("Channel opened. remote channel id: %u, remote window size: %u, "
       "remote max packet size: %u",
       remoteChannelId, remoteWindowSize, remoteMaxPacketSize);
#endif
   m_remoteChannel = remoteChannelId;
   m_remoteWindowSize = remoteWindowSize;
   m_remoteMaxPacketSize = remoteMaxPacketSize;
   setChannelState(SessionEstablished);
   if (oldState == CloseRequested)
       closeChannel();
   else
       handleOpenSuccessInternal();
}
Beispiel #9
0
int main(int argc, char **argv)
{
  char ID;
  ID=bindOutputChannel(7,38);
  setChannelState(ID,1);
  return 0;
}
Beispiel #10
0
void AbstractSshChannel::closeChannel()
{
    if (m_state == CloseRequested) {
        m_timeoutTimer.stop();
    } else if (m_state != Closed) {
        if (m_state == Inactive) {
            setChannelState(Closed);
        } else {
            const ChannelState oldState = m_state;
            setChannelState(CloseRequested);
            if (m_remoteChannel != NoChannel) {
                m_sendFacility.sendChannelEofPacket(m_remoteChannel);
                m_sendFacility.sendChannelClosePacket(m_remoteChannel);
            } else {
                QSSH_ASSERT(oldState == SessionRequested);
            }
        }
    }
}
Beispiel #11
0
void AbstractSshChannel::handleChannelClose()
{
    qCDebug(sshLog, "Receiving CLOSE for channel %u", m_localChannel);
    if (channelState() == Inactive || channelState() == Closed) {
        throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR,
            "Unexpected SSH_MSG_CHANNEL_CLOSE message.");
    }
    closeChannel();
    setChannelState(Closed);
}
Beispiel #12
0
void AbstractSshChannel::requestSessionStart()
{
    // Note: We are just being paranoid here about the Botan exceptions,
    // which are extremely unlikely to happen, because if there was a problem
    // with our cryptography stuff, it would have hit us before, on
    // establishing the connection.
    try {
        m_sendFacility.sendSessionPacket(m_localChannel, initialWindowSize(), maxPacketSize());
        setChannelState(SessionRequested);
        m_timeoutTimer.start(ReplyTimeout);
    }  catch (const Botan::Exception &e) {
        qDebug("Botan error: %s", e.what());
        closeChannel();
    }
}
SshForwardedTcpIpTunnelPrivate::SshForwardedTcpIpTunnelPrivate(quint32 channelId,
                                                               SshSendFacility &sendFacility) :
    SshTcpIpTunnelPrivate(channelId, sendFacility)
{
    setChannelState(SessionRequested);
}