Exemplo n.º 1
0
bool wxCurlFTP::Put(wxInputStream& buffer, const wxString& szRemoteFile /*= wxEmptyString*/)
{
	curl_off_t iSize = 0;

	if(m_pCURL && buffer.IsOk())
	{
		SetCurlHandleToDefaults(szRemoteFile);

		iSize = buffer.GetSize();

		if(iSize == (~(ssize_t)0))
			return false;

		SetOpt(CURLOPT_UPLOAD, TRUE);
		SetStreamReadFunction(buffer);
		SetOpt(CURLOPT_INFILESIZE_LARGE, iSize);

		if(Perform())
		{
			return ((m_iResponseCode > 199) && (m_iResponseCode < 300));
		}
	}

	return false;
}
Exemplo n.º 2
0
bool wxCurlHTTP::Put(wxInputStream& buffer, const wxString& szRemoteFile /*= wxEmptyString*/)
{
    curl_off_t iSize = 0;

    if(m_pCURL && buffer.IsOk())
    {
        SetCurlHandleToDefaults(szRemoteFile);

        iSize = buffer.GetSize();

        if(iSize == (~(size_t)0))	// wxCurlHTTP does not know how to upload unknown length streams.
            return false;

        SetOpt(CURLOPT_UPLOAD, TRUE);
        SetOpt(CURLOPT_PUT, TRUE);
        SetStreamReadFunction(buffer);
        SetOpt(CURLOPT_INFILESIZE_LARGE, (curl_off_t)iSize);
        SetStringWriteFunction(m_szResponseBody);

        if(Perform())
        {
            return IsResponseOk();
        }
    }

    return false;
}
Exemplo n.º 3
0
Arquivo: sock.c Projeto: scottg/nsdci
void
Dci_SockOpts(int sock, int type)
{
    SetOpt(sock, IPPROTO_TCP, TCP_NODELAY, 1);
    if (type == DCI_SOCK_SERVER) {
    	SetOpt(sock, SOL_SOCKET, SO_KEEPALIVE, 1);
#ifdef TCL_KEEPALIVE
    	SetOpt(sock, IPPROTO_TCP, TCP_KEEPALIVE, 300); /* NB: 5 minutes. */
#endif
    }
}
Exemplo n.º 4
0
bool	Options::SwitchOpt	(int Option)
{
	if (Option < OPTION_COUNT)
		return SetOpt(Option, !GetOpt(Option));

	return false;
}
Exemplo n.º 5
0
bool wxCurlHTTP::Trace(const wxString& szRemoteFile /*= wxEmptyString*/)
{
    if(m_pCURL)
    {
        SetCurlHandleToDefaults(szRemoteFile);

        m_arrHeaders.Add(wxT("Content-type: message/http"));

        SetHeaders();

        SetOpt(CURLOPT_CUSTOMREQUEST, "TRACE");
        SetStringWriteFunction(m_szResponseBody);

        if(Perform())
        {
            ResetHeaders();

            return IsResponseOk();
        }

        ResetHeaders();
    }

    return false;
}
Exemplo n.º 6
0
bool wxCurlFTP::Rename(const wxString& szRemoteLocName, 
                       const wxString& szRemoteFile /*= wxEmptyString*/)
{
	if(m_pCURL)
	{
		SetCurlHandleToDefaults(szRemoteFile);

        wxString url(GetURL().c_str(), wxConvUTF8);
		m_szCurrFullPath = url.BeforeLast('/');
		m_szCurrFullPath += wxS("/");
		m_szCurrFilename = url.AfterLast('/');

		if(m_szCurrFilename.IsEmpty())
			return false;

		AppendPostQuote(wxS("RNFR ") + m_szCurrFilename, true);
		AppendPostQuote(wxS("RNTO ") + szRemoteLocName);

		SetCurlHandleQuoteOpts();
		SetOpt(CURLOPT_NOBODY, TRUE);

		if(Perform())
		{
			ResetAllQuoteLists();

			return ((m_iResponseCode > 199) && (m_iResponseCode < 300));
		}

		ResetAllQuoteLists();
	}

	return false;
}
Exemplo n.º 7
0
bool wxCurlFTP::RmDir(const wxString& szRemoteLoc /*= wxEmptyString*/)
{
	if(m_pCURL)
	{
        wxString str(szRemoteLoc);
		if(str.Last() != wxS('/'))
			str += wxS("/");
        SetCurlHandleToDefaults(str);

        wxString url(GetURL().c_str(), wxConvUTF8);
		m_szCurrFullPath = url.Left(url.Len() - 1).BeforeLast(wxS('/'));
		m_szCurrFullPath += wxS("/");
		m_szCurrFilename = url.Left(url.Len() - 1).AfterLast(wxS('/'));

		if(m_szCurrFilename.IsEmpty())
			return false;

		AppendPostQuote(wxS("RMD ") + m_szCurrFilename, true);

		SetCurlHandleQuoteOpts();
		SetOpt(CURLOPT_NOBODY, TRUE);

		if(Perform())
		{
			ResetAllQuoteLists();

			return ((m_iResponseCode > 199) && (m_iResponseCode < 300));
		}

		ResetAllQuoteLists();
	}

	return false;
}
Exemplo n.º 8
0
void cIncEnsembleCamera::OptLineaireOnDirL2
     (
           std::list<cIncSetLiaison *> *        aListSL,
           const std::vector<cFonctrPond> &     aFoncAux
           // bool                                 CalcMatr
     )
{
    mListSl = aListSL;
    mFoncsAux = aFoncAux;

    SetOpt();
/*
    if (CalcMatr)
    {
        ResetEquation();
        ScoreCurGen(true,true);
    }
*/

    Im1D_REAL8  anIm =  mSys->GSSR_Solve((bool *)0);


    SetImState0();
    SetCurDir(anIm.data());

    cIEC_OptimCurDir anOpti(*this);
    REAL aLambda = anOpti.Optim(0,1);

    SetLambda(aLambda);
}
Exemplo n.º 9
0
void GetOpts(int *argc, char **argv, OptTabType *OptTab)
/* get options from command line */
{
    int ArgOrig, ArgNeu;
    char *PtrArg;
    OptDescrType *PtrOptDescr;

    OptErr = OptOK;
    ArgNeu = 0;
    for (ArgOrig = 1; ArgOrig < *argc; ArgOrig++) {
        /* test if switch character found */
        if (argv[ArgOrig][0] == '-' || argv[ArgOrig][0] == '/') {
            /* analyse argument */
            PtrArg = argv[ArgOrig] + 1;
            while (PtrArg[0] != '\0') {
                /* search option description in options table */
                PtrOptDescr = SearchOpt(PtrArg[0], OptTab);
                PtrArg++;
                /* test if option description exists */
                if (PtrOptDescr != NULL) {
                    /* set option resp. assign option argument */
                    PtrArg = SetOpt(PtrOptDescr, PtrArg);
                } else {
                    /* set OptErr */
                    OptErr = OptNotDefErr;
                }
            }
        } else {
            /* copy argument in new argv */
            ArgNeu++;
            argv[ArgNeu] = argv[ArgOrig];
        }
    }
    *argc = ArgNeu + 1;
}
Exemplo n.º 10
0
void wxCurlFTP::SetCurlHandleQuoteOpts()
{
	if(m_pQuote)
	{
		SetOpt(CURLOPT_QUOTE, m_pQuote);
	}

	if(m_pPreQuote)
	{
		SetOpt(CURLOPT_PREQUOTE, m_pPreQuote);
	}

	if(m_pPostQuote)
	{
		SetOpt(CURLOPT_POSTQUOTE, m_pPostQuote);
	}
}
Exemplo n.º 11
0
bool wxCurlHTTP::Head(const wxString& szRemoteFile /*= wxEmptyString*/)
{
    if(m_pCURL)
    {
        SetCurlHandleToDefaults(szRemoteFile);

        SetOpt(CURLOPT_HTTPGET, TRUE);
        SetOpt(CURLOPT_NOBODY, TRUE);

        if(Perform())
        {
            return IsResponseOk();
        }
    }

    return false;
}
Exemplo n.º 12
0
bool wxCurlFTP::Info(const wxString& szRemoteLoc /*= wxEmptyString*/)
{
	if(m_pCURL)
	{
		SetCurlHandleToDefaults(szRemoteLoc);

		SetOpt(CURLOPT_HEADER, TRUE);
		SetOpt(CURLOPT_NOBODY, TRUE);
		SetStringWriteFunction(m_szResponseBody);

		if(Perform())
		{
			return ((m_iResponseCode > 199) && (m_iResponseCode < 299));
		}
	}

	return false;
}
Exemplo n.º 13
0
// Windows
    ///////////////////////////////////////////////////////////////////////
    // Function: UpdateAcceptContext
    //
    //   Author: $author$
    //     Date: 5/15/2009
    ///////////////////////////////////////////////////////////////////////
    virtual EvError UpdateAcceptContext
    (SOCKET socket) 
    {
        SOCKET optValue = socket;
        EvError error = SetOpt
        (SOL_SOCKET, SO_UPDATE_ACCEPT_CONTEXT,
         &optValue, ((SOCKET_OPT_LENGTH)sizeof(optValue)));
        return error;
    }
Exemplo n.º 14
0
 ///////////////////////////////////////////////////////////////////////
 // Function: SetNoDelayOpt
 //
 //   Author: $author$
 //     Date: 5/15/2009
 ///////////////////////////////////////////////////////////////////////
 virtual EvError SetNoDelayOpt
 (bool on=true) 
 {
     int optValue = IN_SOCKET_NODELAY_ON(on);
     EvError error = SetOpt
     (IPPROTO_TCP, TCP_NODELAY,
      &optValue, ((SOCKET_OPT_LENGTH)sizeof(optValue)));
     return error;
 }
Exemplo n.º 15
0
bool wxCurlHTTP::Post(const wxString& szRemoteFile /*= wxEmptyString*/)
{
    if(m_pCURL && m_pPostHead && m_pPostTail)
    {
        SetCurlHandleToDefaults(szRemoteFile);

        SetOpt(CURLOPT_POST, TRUE);
        SetOpt(CURLOPT_HTTPPOST, m_pPostHead);
        SetStringWriteFunction(m_szResponseBody);

        if(Perform())
        {
            return IsResponseOk();
        }
    }

    return false;
}
Exemplo n.º 16
0
 ///////////////////////////////////////////////////////////////////////
 ///  Function: SetNoDelayOpt
 ///
 ///    Author: $author$
 ///      Date: 1/31/2012
 ///////////////////////////////////////////////////////////////////////
 virtual XosError SetNoDelayOpt(bool on=true)
 {
     XosError error = XOS_ERROR_FAILED;
     int optValue = IN_SOCKET_NODELAY_ON(on);
     error = SetOpt
     (IPPROTO_TCP, TCP_NODELAY,
      &optValue, ((SOCKET_OPT_LENGTH)sizeof(optValue)));
     return error;
 }
Exemplo n.º 17
0
void wxCurlFTP::ResetPostQuoteList()
{
	if(m_pPostQuote)
	{
		curl_slist_free_all(m_pPostQuote);

		m_pPostQuote = NULL;

		SetOpt(CURLOPT_POSTQUOTE, NULL);
	}
}
Exemplo n.º 18
0
bool wxCurlFTP::MkDir(const wxString& szRemoteLoc /*= wxEmptyString*/)
{
	if(m_pCURL)
	{
		wxString str(szRemoteLoc);
		if(str.Last() != '/')
			str += wxS("/");

        SetCurlHandleToDefaults(str);

		SetOpt(CURLOPT_FTP_CREATE_MISSING_DIRS, TRUE);
		SetOpt(CURLOPT_NOBODY, TRUE);

		if(Perform())
		{
			return ((m_iResponseCode > 199) && (m_iResponseCode < 300));
		}
	}

	return false;
}
Exemplo n.º 19
0
REAL cIncEnsembleCamera::ScoreCurGen(bool WithFaux,bool CumulDeriv)
{
    SetOpt();
    REAL mMoyResidu = 0.0;
    REAL  mNbPts = 0.0;

    for 
    (
             std::list<cIncSetLiaison *>::iterator anIt = mListSl->begin(); 
             anIt != mListSl->end();
             anIt ++
    )
    {
         cIncCpleCamera * aCple = (*anIt)->Cple();
         ElPackHomologue & aPack = (*anIt)->Pack();
         for
         (
                ElPackHomologue::iterator itHoms = aPack.begin();
                itHoms != aPack.end();
                itHoms++
         )
         {
            Pt2dr aP1 = itHoms->P1();
            Pt2dr aP2 = itHoms->P2();
            REAL aPds =  itHoms->Pds();

            REAL Residu = CumulDeriv ?
                          aCple->DevL1AddEqCoPlan(aP1,aP2,aPds,*mSys):
                          aCple->ValEqCoPlan(aP1,aP2);

            mMoyResidu += ElSquare(Residu )* aPds;
            mNbPts += aPds;
         }
    }

    if (WithFaux)
    {
       for (INT aK = 0 ; aK<INT(mFoncsAux.size()) ; aK++)
       {
            cFonctrPond aFP = mFoncsAux[aK];
            
            if (CumulDeriv)
               StdAddEq(aFP.mFctr,aFP.mPds);
            else
               aFP.mFctr->ComputeValAndSetIVC();
            mMoyResidu += ElSquare(aFP.mFctr->Val(0)) * aFP.mPds;
            mNbPts +=  aFP.mPds;
       }
    }


    return mMoyResidu / mNbPts;
}
Exemplo n.º 20
0
    ///////////////////////////////////////////////////////////////////////
    // Function: SetDontLingerOpt
    //
    //   Author: $author$
    //     Date: 5/15/2009
    ///////////////////////////////////////////////////////////////////////
    virtual EvError SetDontLingerOpt
    (bool on=true) 
    {
        SOCKET_LINGER linger;
        EvError error;

        SET_SOCKET_DONT_LINGER_ON(linger, on);
        SET_SOCKET_LINGER_SECONDS(linger, 0);

        error = SetOpt
        (SOL_SOCKET, SO_LINGER, &linger, sizeof(linger));
        return error;
    }
Exemplo n.º 21
0
void wxCurlFTP::SetCurlHandleToDefaults(const wxString& relativeURL)
{
	wxCurlBase::SetCurlHandleToDefaults(relativeURL);

	m_szCurrFilename = wxEmptyString;
	m_szCurrFullPath = wxEmptyString;

	if(m_bUsePortOption)
	{
		SetStringOpt(CURLOPT_FTPPORT, m_szPortParam);
	}

	if(m_bUseEPRT)
	{
		SetOpt(CURLOPT_FTP_USE_EPRT, TRUE);
	}

	if(m_bUseEPSV)
	{
		SetOpt(CURLOPT_FTP_USE_EPSV, TRUE);
	}

	if(m_bCreateMissingDirs)
	{
		SetOpt(CURLOPT_FTP_CREATE_MISSING_DIRS, TRUE);
	}

	if(m_bAppend)
	{
		SetOpt(CURLOPT_FTPAPPEND, TRUE);
	}

	if(m_tmMode == kASCII)
	{
		SetOpt(CURLOPT_TRANSFERTEXT, TRUE);
	}
}
Exemplo n.º 22
0
/////////////////////////////////////////////////
// Lexical-Input
TILx::TILx(const PSIn& _SIn, const TFSet& OptSet, const TLxChDefTy& ChDefTy):
  ChDef(TLxChDef::GetChDef(ChDefTy)),
  SIn(_SIn), RSIn(*SIn),
  PrevCh(' '), Ch(' '), LnN(0), LnChN(0-1), ChN(0-1),
  PrevSymStStack(), RwStrH(50),
  IsCmtAlw(false), IsRetEoln(false), IsSigNum(false),
  IsUniStr(false), IsCsSens(false), IsExcept(false),
  IsTabSep(false), IsList(false),
  Sym(syUndef),
  Str(), UcStr(), CmtStr(),
  Bool(false), Int(0), Flt(0),
  SymLnN(-1), SymLnChN(-1), SymChN(-1){
  for (int Opt=0; Opt<iloMx; Opt++){
    if (OptSet.In(Opt)){SetOpt(Opt, true);}}
}
Exemplo n.º 23
0
void cIncEnsembleCamera::OptimPowel
     (
          std::list<cIncSetLiaison *> *  aListSL,
          const std::vector<cFonctrPond> &     aFoncAux,
          REAL tol,
          INT ItMax
     )
{
    mListSl = aListSL;
    mFoncsAux = aFoncAux;
    SetOpt();
    Im1D_REAL8 I = CurVals();

    cIEC_OptimPowel aOpt(*this);
    aOpt.powel(I.data(),tol,ItMax);
    SetPtCur(I.data());
}
Exemplo n.º 24
0
bool wxCurlHTTP::Delete(const wxString& szRemoteLoc /*= wxEmptyString*/)
{
    if(m_pCURL)
    {
        SetCurlHandleToDefaults(szRemoteLoc);

        SetOpt(CURLOPT_CUSTOMREQUEST, "DELETE");
        SetStringWriteFunction(m_szResponseBody);

        if(Perform())
        {
            return IsResponseOk();
        }
    }

    return false;
}
Exemplo n.º 25
0
bool wxCurlHTTP::Get(wxOutputStream& buffer, const wxString& szRemoteFile /*=wxEmptyString*/)
{
    if(m_pCURL && buffer.IsOk())
    {
        SetCurlHandleToDefaults(szRemoteFile);

        SetOpt(CURLOPT_HTTPGET, TRUE);
        SetStreamWriteFunction(buffer);

        if(Perform())
        {
            return IsResponseOk();
        }
    }

    return false;
}
Exemplo n.º 26
0
bool wxCurlFTP::Nlst(const wxString& szRemoteLoc /*= wxEmptyString*/)
{
	if(m_pCURL)
	{
		SetCurlHandleToDefaults(szRemoteLoc);

		SetOpt(CURLOPT_CUSTOMREQUEST, "NLST");
		SetStringWriteFunction(m_szResponseBody);

		if(Perform())
		{
			return ((m_iResponseCode > 199) && (m_iResponseCode < 300));
		}
	}

	return false;
}
Exemplo n.º 27
0
    ///////////////////////////////////////////////////////////////////////
    ///  Function: SetLingerOpt
    ///
    ///    Author: $author$
    ///      Date: 1/31/2012
    ///////////////////////////////////////////////////////////////////////
    virtual XosError SetLingerOpt
    (bool on=true, int lingerSeconds=-1)
    {
        XosError error = XOS_ERROR_FAILED;
        SOCKET_LINGER linger;

        if (0 > lingerSeconds)
            lingerSeconds = DEFAULT_SOCKET_LINGER_SECONDS;

        SET_SOCKET_LINGER_ON(linger, on);
        SET_SOCKET_LINGER_SECONDS(linger, lingerSeconds);

        error = SetOpt
        (SOL_SOCKET, SO_LINGER, 
         &linger, ((SOCKET_OPT_LENGTH)sizeof(linger)));
        return error;
    }
Exemplo n.º 28
0
void cIncEnsembleCamera::OptimJacobi
     (
          std::list<cIncSetLiaison *> *  aListSL,
          const std::vector<cFonctrPond> &     aFoncAux
     )
{
    mListSl = aListSL;
    mFoncsAux = aFoncAux;
    SetOpt();
    ELISE_ASSERT(mL2Opt,"Need L2 Sys for OptimJacobi");

    mSysL2->GetMatr(mMatrL2,mMatrtB);
    jacobi_diag(mMatrL2,mMatrValP,mMatrVecP);

    mtBVecP = mMatrtB * mMatrVecP;

cElRanGen aR;
Im1D_REAL8 P0 = CurVals();
Im1D_REAL8 mImBest  = CurVals();


REAL aScInit = ScoreCur(false);
REAL aScMin = aScInit;
REAL aScAmMin = aScInit;
for (INT aTest =0 ; aTest < 100 ; aTest ++)
{
    SetPtCur(P0.data());
    Im1D_REAL8 aDir( NbVal(),0.0);
    

    for (INT aK = 0 ; aK < NbVal() ; aK++)
    {
        ELISE_ASSERT(mMatrValP(aK,aK) != 0,"Jcobi ");
        REAL Val = (mtBVecP(aK,0) /  ElAbs(mMatrValP(aK,aK)))  ;

	REAL aRan = aR.cNRrandom3()  ;

        if (aRan < 0.25)
        {
             Val = 0;
        }
        else if (aRan < 0.5)
	;
	/*
        {
             Val = Val; 
        }
	*/
        else
            Val *=  3 * aR.cNRrandom3() -1;
     

        for (INT aY =0 ; aY< NbVal() ; aY++)
            aDir.data()[aY] += mMatrVecP(aK,aY) * Val;

    }

    ELISE_COPY(aDir.all_pts(),P0.in() + aDir.in(),aDir.out());
    SetPtCur(aDir.data());
    REAL aSc = ScoreCur(false);

if (aSc < aScMin)
{
    ElSetMin(aScMin,aSc);

    for (INT aK= 0 ; aK< 10 ; aK++)
        OneItereDevL1( aK < 3);

    REAL aSc = ScoreCur(false);
    if (aSc < aScAmMin)
    {
         aScAmMin = aSc;
         ELISE_COPY(mImBest.all_pts(),CurVals().in(),mImBest.out());
    }
   
}
    cout  <<  aScMin << " " << aScInit  << " " << aSc <<  " " << aScAmMin << "\n";
}
    SetPtCur(mImBest.data());
}
Exemplo n.º 29
0
//---------------------------------------------------------------------------
void __fastcall TOptDialog::BtnOkClick(TObject *Sender)
{
	SetOpt();
}
    void allowReuse(TInt yes) {
	TInt err = SetOpt(KSoReuseAddr, KSolInetIp, yes);
    }