std::string PersistCommand::GetString() const
{
	if (m_activity->IsPersistTokenSet()) {
		return (GetMethod() + " " + m_activity->GetPersistToken()->GetString());
	} else {
		return GetMethod() + "(no token)";
	}
}
Beispiel #2
0
int XNav::call_method( const char *method, const char *filter,
		       pwr_sAttrRef attrref, 
		       xmenu_eItemType item_type, 
		       xmenu_mUtility caller,
		       unsigned int priv, char *arg)
{
  pwr_tStatus 	sts;
  int		sel_cnt;
  pwr_tStatus (*method_func)( xmenu_sMenuCall *);
  pwr_tStatus (*filter_func)( xmenu_sMenuCall *);

  if (mcp == NULL)
    mcp = (xmenu_sMenuCall *)calloc(1, sizeof(xmenu_sMenuCall));

  mcp->EditorContext = (void *)this;
  mcp->PointedSet = xmenu_eMenuSet_Object;

  mcp->Pointed = attrref;
  mcp->Caller = caller;
  mcp->ItemType = item_type;
  mcp->Priv = priv;
  mcp->SelectedSet = xmenu_eMenuSet_None;
  mcp->SelectedSet = xmenu_eMenuSet_Object;
  if ( arg)
    strcpy( mcp->Arg, arg);

  sel_cnt = 1;
  if ( mcp->Selected)
    free( mcp->Selected);
  mcp->Selected = (pwr_sAttrRef *) calloc( sel_cnt + 1, sizeof (pwr_sAttrRef));
  mcp->Selected[0] = attrref;
  mcp->Selected[sel_cnt].Objid = pwr_cNObjid;
  mcp->SelectCount = sel_cnt;

  if ( filter && strcmp( filter, "") != 0) {
    sts = GetMethod( filter, &filter_func);
    if ( EVEN(sts)) return sts;

    sts = (filter_func) ( mcp);
    if ( EVEN(sts)) return sts;
  }

  sts = GetMethod( method, &method_func);
  if ( EVEN(sts)) return sts;

  sts = (method_func) ( mcp);
  if ( EVEN(sts)) return sts;

  free( mcp->Selected);
  mcp->Selected = 0;

  return XNAV__SUCCESS;
}
Beispiel #3
0
bool MythFEXML::ProcessRequest( HTTPRequest *pRequest )
{
    if (!pRequest)
        return false;

    if (pRequest->m_sBaseUrl != m_sControlUrl)
        return false;

    LOG(VB_UPNP, LOG_INFO, QString("MythFEXML::ProcessRequest: %1 : %2")
            .arg(pRequest->m_sMethod).arg(pRequest->m_sRawRequest));

    switch(GetMethod(pRequest->m_sMethod))
    {
        case MFEXML_GetServiceDescription:
            pRequest->FormatFileResponse(m_sServiceDescFileName);
            break;
        case MFEXML_GetScreenShot:
            GetScreenShot(pRequest);
            break;
        case MFEXML_ActionListTest:
            GetActionListTest(pRequest);
            break;
        case MFEXML_GetRemote:
            GetRemote(pRequest);
            break;
        default:
            UPnp::FormatErrorResponse(pRequest, UPnPResult_InvalidAction);
    }
    return true;
}           
Beispiel #4
0
bool UPnpMSRR::ProcessRequest( HttpWorkerThread *pThread, HTTPRequest *pRequest )
{
    if (pRequest)
    {
        if (Eventing::ProcessRequest( pThread, pRequest ))
            return true;

        if ( pRequest->m_sBaseUrl != m_sControlUrl )
            return false;

        VERBOSE(VB_UPNP, QString("UPnpMSRR::ProcessRequest : %1 : %2 :")
                            .arg( pRequest->m_sBaseUrl )
                            .arg( pRequest->m_sMethod  ));

        switch( GetMethod( pRequest->m_sMethod ) )
        {
            case MSRR_GetServiceDescription : pRequest->FormatFileResponse( m_sServiceDescFileName ); break;
            case MSRR_IsAuthorized          : HandleIsAuthorized          ( pRequest ); break;
            case MSRR_RegisterDevice        : HandleRegisterDevice        ( pRequest ); break;
            case MSRR_IsValidated           : HandleIsValidated           ( pRequest ); break;

            default:
                UPnp::FormatErrorResponse( pRequest, UPnPResult_InvalidAction );
                break;
        }       
    }

    return( true );

}
Beispiel #5
0
bool IrisClass::_FunctionAchieved() {
	_InterfaceFunctionDeclareMap mpFunctionDeclare;
	// 递归调用,把所有的接口的FunctionDeclare给放到map里面
	for (auto inter : m_hsInterfaces){
		_FunctionCollect(inter.second, mpFunctionDeclare);
	}

	bool bResult = false;
	IrisMethod* pMethod = nullptr;
	// 开始逐个检查
	for (auto funcdec : mpFunctionDeclare) {
		pMethod = GetMethod(IrisClass::SearchMethodType::InstanceMethod, funcdec.first, bResult);
		// 如果没有找到,那么直接退出
		if (!pMethod) {
			return false;
		}
		else {
			// 如果找到了但是参数不对,还是退出
			auto pMethodDeclare = funcdec.second;
			if (pMethod->m_bIsWithVariableParameter != pMethodDeclare.m_bHaveVariableParameter
				|| pMethod->m_nParameterAmount != pMethodDeclare.m_nParameterAmount) {
				return false;
			}
		}
	}
	return true;
}
Beispiel #6
0
			static void CollectTypeDescriptors(WfCustomType* td, SortedList<ITypeDescriptor*>& tds)
			{
				vint baseCount = td->GetBaseTypeDescriptorCount();
				for (vint i = 0; i < baseCount; i++)
				{
					auto baseType = td->GetBaseTypeDescriptor(i);
					CollectTypeDescriptors(baseType, tds);
				}

				vint methodGroupCount = td->GetMethodGroupCount();
				for (vint i = 0; i < methodGroupCount; i++)
				{
					auto group = td->GetMethodGroup(i);
					vint methodCount = group->GetMethodCount();
					for (vint j = 0; j < methodCount; j++)
					{
						auto method = group->GetMethod(j);
						CollectTypeDescriptors(method, tds);
					}
				}

				vint propertyCount = td->GetPropertyCount();
				for (vint i = 0; i < propertyCount; i++)
				{
					CollectTypeDescriptors(td->GetProperty(i), tds);
				}

				vint eventCount = td->GetEventCount();
				for (vint i = 0; i < eventCount; i++)
				{
					CollectTypeDescriptors(td->GetEvent(i), tds);
				}
			}
Beispiel #7
0
bool UPnpCMGR::ProcessRequest( HttpWorkerThread *pThread, HTTPRequest *pRequest )
{
    if (pRequest)
    {
        if (Eventing::ProcessRequest( pThread, pRequest ))
            return true;

        if ( pRequest->m_sBaseUrl != m_sControlUrl )
        {
//            VERBOSE( VB_UPNP, QString("UPnpCMGR::ProcessRequest - BaseUrl (%1) not ours...").arg(pRequest->m_sBaseUrl ));
            return false;
        }

        VERBOSE( VB_UPNP, QString("UPnpCMGR::ProcessRequest - Method (%1)").arg(pRequest->m_sMethod ));

        switch( GetMethod( pRequest->m_sMethod ) )
        {
            case CMGRM_GetServiceDescription   : pRequest->FormatFileResponse  ( m_sServiceDescFileName ); break;
            case CMGRM_GetProtocolInfo         : HandleGetProtocolInfo         ( pRequest ); break;
            case CMGRM_GetCurrentConnectionInfo: HandleGetCurrentConnectionInfo( pRequest ); break;
            case CMGRM_GetCurrentConnectionIDs : HandleGetCurrentConnectionIDs ( pRequest ); break;
            default:
                UPnp::FormatErrorResponse( pRequest, UPnPResult_InvalidAction );
                break;
        }       
        return true;
    }

    return false;
}
void HttpDebugSocket::OnFirst()
{
	Send(
		"HTTP/1.1 200 OK\n"
		"Content-type: text/html\n"
		"Connection: close\n"
		"Server: HttpDebugSocket/1.0\n"
		"\n");
	Send(
		"<html><head><title>Echo Request</title></head>"
		"<body><h3>Request Header</h3>");
	Send(	"<form method='post' action='/test_post'>"
		"<input type='text' name='text' value='test text'><br>"
		"<input type='submit' name='submit' value=' OK '></form>");

	// enctype 'multipart/form-data'
	Sendf("<form action='/test_post' method='post' enctype='multipart/form-data'>");
	Sendf("<input type=file name=the_file><br>");
	Sendf("<input type=text name=the_name><br>");
	Sendf("<input type=submit name=submit value=' test form-data '>");
	Sendf("</form>");

	Send(	"<pre style='background: #e0e0e0'>");
	Send(GetMethod() + " " + GetUrl() + " " + GetHttpVersion() + "\n");
}
int GetArgsCount(JNIEnv *env, jobject args)
{
	jmethodID mid = GetMethod(env, "com/yeguang/paramprotocol/ParamArgs",
		"getCount", "()I");

	return env->CallIntMethod(args, mid);
}
Beispiel #10
0
bool MythFEXML::ProcessRequest( HttpWorkerThread *pThread, HTTPRequest *pRequest )
{
    try
    {
        if (pRequest)
        {
            if (pRequest->m_sBaseUrl != m_sControlUrl)
                return( false );

            VERBOSE(VB_UPNP, QString("MythFEXML::ProcessRequest: %1 : %2")
                         .arg(pRequest->m_sMethod)
                     .arg(pRequest->m_sRawRequest));

            switch( GetMethod( pRequest->m_sMethod ))
            {
                case MFEXML_GetScreenShot      : GetScreenShot    ( pRequest ); return true;


                default: 
                {
                    UPnp::FormatErrorResponse( pRequest, UPnPResult_InvalidAction );

                    return true;
                }
            }
        }
    }
    catch( ... )
    {
        VERBOSE( VB_IMPORTANT, "MythFEXML::ProcessRequest() - Unexpected Exception" );
    }

    return( false );
}           
Beispiel #11
0
bool UPnpCDS::ProcessRequest( HttpWorkerThread *pThread, HTTPRequest *pRequest )
{
    if (pRequest)
    {
        if (Eventing::ProcessRequest( pThread, pRequest ))
            return true;

        if ( pRequest->m_sBaseUrl != m_sControlUrl )
        {
//            VERBOSE( VB_UPNP, QString("UPnpCDS::ProcessRequest - BaseUrl (%1) not ours...").arg(pRequest->m_sBaseUrl ));
            return false;
        }

        switch( GetMethod( pRequest->m_sMethod ) )
        {
            case CDSM_GetServiceDescription : pRequest->FormatFileResponse( m_sServiceDescFileName ); break;
            case CDSM_Browse                : HandleBrowse                ( pRequest ); break;
            case CDSM_Search                : HandleSearch                ( pRequest ); break;
            case CDSM_GetSearchCapabilities : HandleGetSearchCapabilities ( pRequest ); break;
            case CDSM_GetSortCapabilities   : HandleGetSortCapabilities   ( pRequest ); break;
            case CDSM_GetSystemUpdateID     : HandleGetSystemUpdateID     ( pRequest ); break;
            default:
                UPnp::FormatErrorResponse( pRequest, UPnPResult_InvalidAction );
                break;
        }

        return true;
    }

    return false;

}
Beispiel #12
0
SecurityClientSSL::SecurityClientSSL(	Address& Address,
										std::string certFile,
										std::string keyFile,
										std::string trustFile,
										std::string password,
										securityMode method) :
	SecurityClient(Address),
	itsSecurityMode(method),
	itsCertificate(new Certificate()), itsKey(new Key()), itsTrust(new Trust())
{
	SetCertificate(certFile);
	SetKey(keyFile);
	SetTrust(trustFile);
	itsPassword = password;
	libsslInit();

	itsCTX = SSLWrap::SSL_CTX_new(GetMethod()); /* create new context from method */
	if (itsCTX == NULL) {
		throw_SSL("SSL_CTX_new failed");
	}

	SSLWrap::SSL_CTX_set_default_passwd_cb(itsCTX, passwordCallback);
	if (itsPassword.length() >= 4)
		SSLWrap::SSL_CTX_set_default_passwd_cb_userdata(itsCTX, this);

	itsCertificate->SetContext(itsCTX);
	itsKey->SetContext(itsCTX);
	itsTrust->SetContext(itsCTX);

	itsCertificate->Apply();
	itsKey->Apply();
	itsTrust->Apply();

	//create new SSL BIO, basing on a configured context
	BIO* bio = SSLWrap::BIO_new_ssl_connect(itsCTX);
	if (bio == NULL) {
		throw_SSL("BIO_new_ssl_connect failed");
	}

	//make sure SSL is here
	SSLWrap::BIO_get_ssl_(bio, & itsSSL);
	if (itsSSL == NULL) {
		throw_SSL("BIO_get_ssl failed");
	}

	/* With this option set, if the server suddenly wants a new handshake,
	 * OpenSSL handles it in the background. */
	SSLWrap::SSL_set_mode_(itsSSL, SSL_MODE_AUTO_RETRY);

	/*The hostname can be an IP address. The hostname can also include the port
	 * in the form hostname:port . It is also acceptable to use the form
	 * "hostname/any/other/path" or "hostname:port/any/other/path".*/
	SSLWrap::BIO_set_conn_hostname_(bio, itsSrverAddress.GetHostAndPort().c_str());

	DBG << "populated safe client BIO @host=" << itsSrverAddress.GetHostAndPort() << std::endl;
	SetBIO(bio);

	DBG_CONSTRUCTOR;
}
Beispiel #13
0
Variant DynamicObject::m_GetMethod(int numargs, Variant args[])
{
    MethodHandler *mthd = GetMethod(args[0]);
    if (mthd) {
        return anytovariant(mthd->GetName());
    }
    return VARNULL;
}
Beispiel #14
0
void JniFirebase::UnAuth() {
    auto env = getEnv();
    if (!GetMethod(env, s_firebaseClass, "unauth", "()V",
                   &s_unAuth)) {
        return;
    }
    env->CallVoidMethod(m_firebase, s_unAuth);
}
Beispiel #15
0
void JniFirebase::SetJson(const char *value) {
    auto env = getEnv();
    
    if (s_objectMapperInstance == NULL) {
        lock<std::mutex> lock(s_objectMapperLock);
        if (s_objectMapperInstance == NULL) {
            if (!GetClass(env, "java/util/HashMap", &s_objectClass)) {
                return;
            }

            if (!GetClass(env, s_objectMapperClassName, &s_objectMapperClass)) {
                return;
            }

            jmethodID ctor = NULL;
            if (!GetMethod(env, s_objectMapperClass, "<init>", "()V", &ctor))
            {
                return;
            }

            if (!GetMethod(env, s_objectMapperClass, s_objectMapperReadValueName, s_objectMapperReadValueSig, &s_objectMapperReadValue)) {
                return;
            }

            JOBJECT localRef = JOBJECT(env, env->NewObject(s_objectMapperClass, ctor));
            s_objectMapperInstance = env->NewGlobalRef(localRef);
        }
    }
    
    JOBJECT localValue = JOBJECT(env,
                                env->CallObjectMethod(s_objectMapperInstance, s_objectMapperReadValue,
                                                      (jstring)JSTRING(env, env->NewStringUTF(value)), s_objectClass));

    if (env->ExceptionCheck() == JNI_TRUE) {
        SetString(GetJNIExceptionDescription(env, env->ExceptionOccurred()));
        return;
    }
    
    if (!GetMethod(env, s_firebaseClass, s_firebaseSetValueName, s_firebaseSetValueSig, &s_firebaseSetValue)) {
        return;
    }
    
    env->CallVoidMethod(m_firebase, s_firebaseSetValue, (jobject)localValue);
}
static void PrintProperty (LocationObject* loc)
{
	if (!loc) return;
	LocationMethod method = LOCATION_METHOD_NONE;
	LocationPosition *pos = NULL;
	LocationAccuracy *acc = NULL;
	guint pos_interval = 0;
	guint vel_interval = 0;
	guint sat_interval = 0;
	gchar method_str[STR_MAX] = {0, };
	gchar status_str[STR_MAX] = {0, };

	gchar* devname = NULL;

	g_object_get(loc, "method", &method, NULL);
	GetMethod(method_str, method);
	g_printf("method[%s] ", method_str);

	if (LOCATION_METHOD_GPS == method) {
		g_object_get(loc, "dev-name", &devname, NULL);
		if (devname) {
			g_printf("dev-name[%s] ", devname);
			g_free(devname);
		}
	}

	int ret = location_get_last_position (loc, &pos, &acc);
	if (ret == LOCATION_ERROR_NONE) {
		GetStatus(status_str, pos->status);
		g_printf("\nLast position [time(%d) lat(%f) long(%f) alt(%f) status(%s)]",
				pos->timestamp, pos->latitude, pos->longitude, pos->altitude, status_str);
		location_position_free (pos);
		location_accuracy_free (acc);
	}
	
	if (method == LOCATION_METHOD_HYBRID || method == LOCATION_METHOD_GPS) {
		g_object_get(loc, "pos-interval", &pos_interval, NULL);
		g_object_get(loc, "vel-interval", &vel_interval, NULL);
		g_object_get(loc, "sat-interval", &sat_interval, NULL);
	}
	else if (method == LOCATION_METHOD_WPS) {
		g_object_get(loc, "pos-interval", &pos_interval, NULL);
		g_object_get(loc, "vel-interval", &vel_interval, NULL);
	}
	else if (method == LOCATION_METHOD_CPS) {
		g_object_get(loc, "pos-interval", &pos_interval, NULL);
	}
	g_printf("Position interval : [%u], Velocity interval [%u], Satellite interval [%u]\n", pos_interval, vel_interval, sat_interval);

	g_printf("\nSignals: ");
	if (g_sig_enable)  g_printf("[service-enabled], ");
	if (g_sig_disable) g_printf("[service-disabled], ");
	if (g_sig_update)  g_printf("[service-updated], ");
	if (g_sig_zonein)  g_printf("[zone-in], ");
	if (g_sig_zoneout) g_printf("[zone-out]");
}
Beispiel #17
0
bool
InputPort::CheckType() const
{
    Method *code = GetMethod(wxT("check-type"), Project::GetProject()->GetTarget());
    if (code != NULL)
    {
        return code->CheckType(this);
    }
    return false;
}
yeguang::ParamSocket *GetSocket(JNIEnv *env, jobject obj)
{
	// call Lcom/yeguang/paramprotocol/ParamSocket; getSock
	jmethodID mid = GetMethod(env, "com/yeguang/paramprotocol/ParamSocket",
		"getSock", "()J");

	yeguang::ParamSocket *sock = (yeguang::ParamSocket *)env->CallLongMethod(obj, mid);

	return sock;
}
Beispiel #19
0
ColumnScoringMethod ColumnScorer::GetMethodForScorer(unsigned int scorerIndex) const {

    ColumnScoringMethod method = eInvalidColumnScorerMethod;
    if (scorerIndex == 0 && !IsCompound()) {
        method = GetMethod();
    } else if (IsCompound() && scorerIndex < m_scorers.size()) {
        method = m_scorers[scorerIndex]->GetMethod();
    }
    return method;
}
Beispiel #20
0
JniFirebase* JniFirebase::Push() {
    if (!m_firebase) {
        return NULL;
    }
    auto env = getEnv();
    if (!GetMethod(env, s_firebaseClass, s_firebasePushName, s_firebasePushSig, &s_firebasePush)) {
        return NULL;
    }
    return new JniFirebase(env->CallObjectMethod(m_firebase, s_firebasePush));
}
Beispiel #21
0
wxString
OutputPort::GetType() const
{
    Method *code = GetMethod(wxT("get-type"), Project::GetProject()->GetTarget());
    if (code != NULL)
    {
        return code->GetType(this);
    }
    return wxT("?");
}
Beispiel #22
0
void TSExpression::Build(SemanticApi::TGlobalBuildContext build_context)
{
	assert(first_op.get() == nullptr);
	TSemanticTreeBuilder b(build_context, GetSyntax(), GetOwner(), GetMethod(), this);
	auto syntax = GetSyntax();
	if (!syntax->IsEmpty())
		first_op.reset(b.VisitNode(syntax));

	expression_result = dynamic_cast<TSOperation*>(first_op.get())->GetFormalParameter();
}
Beispiel #23
0
bool ScriptFile::Execute(asIScriptObject* object, const String& declaration, const VariantVector& parameters, bool unprepare)
{
    asIScriptFunction* method = GetMethod(object, declaration);
    if (!method)
    {
        LOGERROR("Method " + declaration + " not found in " + GetName());
        return false;
    }
    
    return Execute(object, method, parameters, unprepare);
}
Beispiel #24
0
uint64_t JniFirebase::GetAuthExpiration() {
    auto env = getEnv();
    if (!GetMethod(env, s_firebaseClass, "getAuth", "()Lcom.firebase.client.AuthData;",
                   &s_firebaseGetAuth)) {
        return NULL;
    }
    
    JOBJECT authData = JOBJECT(env, env->CallObjectMethod(m_firebase, s_firebaseGetAuth));
    JniAuth auth = JniAuth(authData);
    return auth.GetAuthExpiration();
}
Beispiel #25
0
void JniFirebase::SetString(const char *value) {
    if (!m_firebase) {
        return;
    }
    auto env = getEnv();
    
    if (!GetMethod(env, s_firebaseClass, s_firebaseSetValueName, s_firebaseSetValueSig, &s_firebaseSetValue)) {
        return;
    }
    env->CallVoidMethod(m_firebase, s_firebaseSetValue, (jstring)JSTRING(env, env->NewStringUTF(value)));
}
Beispiel #26
0
int XNav::CheckMenuMethodFilter( xmenu_sMenuCall *ip, int idx)
{
  pwr_tStatus sts;
  pwr_tStatus (*filter)( xmenu_sMenuCall *);

  sts = GetMethod( ip->ItemList[idx].Filter, &filter);
  if ( ODD(sts))
    sts = (filter) ( ip);

  return sts;
}
Beispiel #27
0
int XNav::CallMenuMethod( xmenu_sMenuCall *ip, int idx)
{
  pwr_tStatus sts;
  pwr_tStatus (*method)( xmenu_sMenuCall *);

  sts = GetMethod( ip->ItemList[idx].Method, &method);
  if ( ODD(sts))
    sts = (method) ( ip);

  return sts;
}
JniChildEventStub::JniChildEventStub(JniFirebase* firebase, jlong cookie) {
    auto env = getEnv();
    
    if (!GetClass(env, s_stubClassName, &s_stubClass)) {
        return;
    }
    
    if (!GetMethod(env, s_stubClass, s_stubCtorName, s_stubCtorSig, &s_stubCtor)) {
        return;
    }
    
    if (!GetMethod(env, s_stubClass, s_stubReleaseName, s_stubReleaseSig, &s_stubRelease)) {
        return;
    }
    
    JOBJECT localRef = JOBJECT(env,
                               env->NewObject(s_stubClass, s_stubCtor, firebase->getJniObject(),
                                              cookie));
    m_stub = env->NewGlobalRef(localRef);
}
Beispiel #29
0
JniFirebase* JniFirebase::Child(const char *value) {
    if (!m_firebase) {
        return NULL;
    }
    auto env = getEnv();
    
    if (!GetMethod(env, s_firebaseClass, s_firebaseChildName, s_firebaseChildSig, &s_firebaseChild)) {
        return NULL;
    }
    JOBJECT childFirebase = JOBJECT(env, env->CallObjectMethod(m_firebase, s_firebaseChild, (jstring)JSTRING(env, env->NewStringUTF(value))));
    return new JniFirebase(childFirebase);
}
Beispiel #30
0
JniFirebase* JniFirebase::Root() {
    if (!m_firebase) {
        return NULL;
    }
    auto env = getEnv();
    
    if (!GetMethod(env, s_firebaseClass, s_firebaseRootName, s_firebaseRootSig, &s_firebaseRoot)) {
        return NULL;
    }
    JOBJECT rootFirebase = JOBJECT(env, env->CallObjectMethod(m_firebase, s_firebaseRoot));
    return new JniFirebase(rootFirebase);
}