Browse Source

adding set_own_key(), modifying basic for multiple parameters

android-1.0.101
Volker Birk 7 years ago
parent
commit
1783193f7b
  1. 17
      src/basic_api.cc
  2. 87
      src/gen_java_Engine.ysl2
  3. 1
      src/pEp.yml2

17
src/basic_api.cc

@ -75,6 +75,22 @@ JNIEXPORT jobject JNICALL Java_org_pEp_jniadapter_Engine_updateIdentity(
return from_identity(env, _ident); return from_identity(env, _ident);
} }
JNIEXPORT jobject JNICALL Java_org_pEp_jniadapter_Engine_setOwnKey(
JNIEnv *env,
jobject obj,
jobject ident,
jbyteArray fpr
)
{
PEP_SESSION session = (PEP_SESSION) callLongMethod(env, obj, "getHandle");
pEp_identity *_ident = to_identity(env, ident);
char *_fpr = to_string(env, fpr);
::set_own_key(session, _ident, _fpr);
return from_identity(env, _ident);
}
JNIEXPORT void JNICALL Java_org_pEp_jniadapter_Engine_keyMistrusted( JNIEXPORT void JNICALL Java_org_pEp_jniadapter_Engine_keyMistrusted(
JNIEnv *env, JNIEnv *env,
jobject obj, jobject obj,
@ -311,6 +327,7 @@ JNIEXPORT void JNICALL Java_org_pEp_jniadapter_Engine_cancel_1sync_1handshake(
JNIEXPORT jbyteArray JNICALL Java_org_pEp_jniadapter_Engine_getCrashdumpLog( JNIEXPORT jbyteArray JNICALL Java_org_pEp_jniadapter_Engine_getCrashdumpLog(
JNIEnv *env, JNIEnv *env,
jobject obj, jobject obj,
jint dummy,
jint maxlines jint maxlines
) )
{ {

87
src/gen_java_Engine.ysl2

@ -34,37 +34,88 @@ tstylesheet {
const "pname", "name(parm/*[2])"; const "pname", "name(parm/*[2])";
|| ||
private native «$itype» «@name»(«$pitype» «$pname»); private native «$itype» «@name»(`apply "parm/*", mode=basic_iparm`);
public «$jtype» «@name»(«$pjtype» «$pname») { public «$jtype» «@name»(`apply "parm/*", mode=basic_parm`) {
|| ||
choose { apply "parm/*", mode=basic_parm_set;
when "$ptype = 'string'"
|> «$pitype» _«$pname» = «$pname».getBytes();
when "$ptype = 'bool'"
|> «$pitype» _«$pname» = «$pname».booleanValue();
when "$ptype = 'int'"
|> «$pitype» _«$pname» = «$pname»;
when "ancestor::namespace/child::enum[@name=$ptype]"
|> «$pitype» _«$pname» = «$pname».value;
otherwise
|> «$pitype» _«$pname» = new «$pitype»(«$pname»);
}
choose { choose {
when "@type = 'void'" when "@type = 'void'"
|> «@name»(_«$pname»); |> «@name»(`apply "parm/*", mode=basic_parm_name`);
when "@type = 'identity'" when "@type = 'identity'"
|> return new Identity(«@name»(_«$pname»)); |> return new Identity(«@name»(`apply "parm/*", mode=basic_parm_name`));
when "@type = 'bool'" when "@type = 'bool'"
|> return new Boolean(«@name»(_«$pname»)); |> return new Boolean(«@name»(`apply "parm/*", mode=basic_parm_name`));
otherwise otherwise
|> return AbstractEngine.toUTF16(«@name»(_«$pname»)); |> return AbstractEngine.toUTF16(«@name»(`apply "parm/*", mode=basic_parm_name`));
} }
|| ||
} }
|| ||
} }
template "*", mode=basic_parm_name choose {
when "position() mod 2" {
if "position() = 1 and name(.)='int'"
> 23,
if "position() > 1" > ,
}
otherwise {
> _«name(.)»
}
}
template "*", mode=basic_parm choose {
when "position() mod 2" {
if "position() > 1" > ,
choose {
when "name(.) = 'string'"
> String
when "name(.) = 'identity'"
> Identity
when "name(.) = 'bool'"
> Boolean
otherwise
> «name(.)»
}
}
otherwise {
> «name(.)»
}
}
template "*", mode=basic_iparm choose {
when "position() mod 2" {
const "pitype" call "toIntermediate" with "type", "name(.)";
if "position() = 1 and name(.)='int'"
> int dummy,
if "position() > 1" > ,
> «$pitype»
}
otherwise {
> «name(.)»
}
}
template "*", mode=basic_parm_set {
const "ptype", "name(preceding-sibling::*[1])";
const "pname", "name(.)";
const "pitype" call "toIntermediate" with "type", "$ptype";
if "not(position() mod 2)" choose {
when "$ptype = 'string'"
| «$pitype» _«$pname» = «$pname».getBytes();
when "$ptype = 'bool'"
| «$pitype» _«$pname» = «$pname».booleanValue();
when "$ptype = 'int'"
| «$pitype» _«$pname» = «$pname»;
when "ancestor::namespace/child::enum[@name=$ptype]"
| «$pitype» _«$pname» = «$pname».value;
otherwise
| «$pitype» _«$pname» = new «$pitype»(«$pname»);
}
}
function "returnJava" { function "returnJava" {
const "returning", "count(parm/creates|parm/returns)"; const "returning", "count(parm/creates|parm/returns)";

1
src/pEp.yml2

@ -237,6 +237,7 @@ namespace pEp {
basic string trustwords(identity ident); basic string trustwords(identity ident);
basic identity myself(identity ident); basic identity myself(identity ident);
basic identity updateIdentity(identity ident); basic identity updateIdentity(identity ident);
basic identity setOwnKey(identity ident, string fpr);
basic void keyMistrusted(identity ident); basic void keyMistrusted(identity ident);
basic void keyResetTrust(identity ident); basic void keyResetTrust(identity ident);
basic void trustPersonalKey(identity ident); basic void trustPersonalKey(identity ident);

Loading…
Cancel
Save