//////////////////////////////////////////////////////////////////////////
//RTSP Proxy Server socket
//////////////////////////////////////////////////////////////////////////
P2PRTSPProxyServerSocket::P2PRTSPProxyServerSocket(
  talk_base::AsyncSocket* socket)
  : P2PProxyServerSocket(socket, KBufferSize),
  is_connect_(false)
{
  //allow handle the request RTSP data
  BufferInput(true);
}
void P2PRTSPProxyServerSocket::ProcessInput(char* data, size_t* len)
{
  data[*len] = '\0';
  //LOG_P2P(BASIC_INFOR) << "------------------------";
  //LOG_P2P(BASIC_INFOR) << "Original data is ";
  //LOG_P2P(BASIC_INFOR) << "\n" << data;
  //LOG_P2P(BASIC_INFOR) << "------------------------";
  if(strncmp(RTSP_HEADER,(const char *)data,RTSP_HEADER_LENGTH) == 0){
    if(!ParseRTSPRequest(data,len)){
      SignalCloseEvent(this,-1);
      return;
    }
  }
  BufferInput(false);
  SignalConnectReadEvent(this,(const void *)data,*len);
  BufferInput(true);
  *len = 0;
  /*BufferInput(false);
  SignalReadEvent(this);
  BufferInput(true);*/
}
Пример #3
0
/* returns false if unknown option, missing parameter,
** or option doesn't use parameter
*/
Bool ParseConfigValue( TidyDocImpl* doc, TidyOptionId optId, ctmbstr optval )
{
    const TidyOptionImpl* option = option_defs + optId;
    Bool status = ( optId < N_TIDY_OPTIONS && optval != NULL );

    if ( !status )
        ReportBadArgument( doc, option->name );
    else
    {
        TidyBuffer inbuf = {0};            /* Set up input source */
        tidyBufAttach( &inbuf, (byte*)optval, tmbstrlen(optval)+1 );
        doc->config.cfgIn = BufferInput( doc, &inbuf, ASCII );
        doc->config.c = GetC( &doc->config );

        status = option->parser( doc, option );

        freeStreamIn(doc->config.cfgIn);  /* Release input source */
        doc->config.cfgIn  = NULL;
        tidyBufDetach( &inbuf );
    }
    return status;
}