Browse Source

...

generate_api
Volker Birk 4 years ago
parent
commit
7329fe7b89
7 changed files with 46 additions and 41 deletions
  1. +0
    -1
      Makefile
  2. +3
    -1
      asn.1/Makefile
  3. +5
    -0
      src/Makefile
  4. +0
    -15
      sync/cond_act_sync.yml2
  5. +11
    -6
      sync/gen_statemachine.ysl2
  6. +0
    -7
      sync/sync.fsm
  7. +27
    -11
      test/src/engine_tests/SyncTests.cc

+ 0
- 1
Makefile View File

@ -48,7 +48,6 @@ clean:
test: all
$(MAKE) -C test test
.PHONY: package
package: clean
cd .. ; COPYFILE_DISABLE=true tar cjf pEpEngine.tar.bz2 "$(HERE_REL)"


+ 3
- 1
asn.1/Makefile View File

@ -24,7 +24,7 @@ Sync.c: sync.asn1 keysync.asn1 pEp.asn1
sync.asn1 keysync.asn1 pEp.asn1:
cp -f ../sync/generated/*.asn1 ../asn.1
.PHONY: clean install uninstall
.PHONY: clean install uninstall tags
clean:
rm -f *.a *.o *.c *.h *.sample sync.asn1 keysync.asn1
@ -33,3 +33,5 @@ install:
uninstall:
tags:
ctags *.c *.h

+ 5
- 0
src/Makefile View File

@ -96,3 +96,8 @@ install: $(TARGET)
uninstall:
rm -f $(PREFIX)/lib/$(TARGET)
rm -rf $(PREFIX)/include/pEp
.PHONY: tags
tags:
ctags *.c *.h

+ 0
- 15
sync/cond_act_sync.yml2 View File

@ -56,18 +56,6 @@ condition keyElectionWon
// action: PEP_STATUS «@name»(PEP_SESSION session)
action closeHandshakeDialog
||
assert(session->notifyHandshake);
if (!session->notifyHandshake)
return PEP_SYNC_NO_NOTIFY_CALLBACK;
PEP_STATUS status = session->notifyHandshake(
session->sync_management, NULL, NULL, SYNC_NOTIFY_OVERTAKEN);
if (status)
return status;
||
function "new_UUID" {
param "dst";
||
@ -92,9 +80,6 @@ function "copy_UUID" {
||
}
action clearState
|> free_Sync_state(session);
action openChallenge
call "new_UUID" with "dst" > &session->own_sync_state.challenge


+ 11
- 6
sync/gen_statemachine.ysl2 View File

@ -347,21 +347,26 @@ tstylesheet {
goto the_end;
switch (message_type) {
// these messages are broadcasted
`` for "fsm/message[@type='broadcast']" |>> case «@name»:
status = _own_identities_retrieve(session, &channels, PEP_idf_not_for_sync);
// these messages are being broadcasted
`` for "fsm/message[@type='broadcast']" |>> case «../@name»__payload_PR_«yml:lcase(@name)»:
status = _own_identities_retrieve(session, &channels, PEP_idf_not_for_«yml:lcase(@name)»);
if (!status)
goto the_end;
if (!(channels && channels->ident)) {
status = PEP_«yml:ucase(@name)»_NO_CHANNEL;
goto the_end;
}
break;
// all other go anycast; previously used address is sticky (unicast)
default: {
if (!session->«yml:lcase(@name)»_state.common.from `> |`|
(session->«yml:lcase(@name)»_state.common.from->flags &
PEP_idf_not_for_sync)) {
PEP_idf_not_for_«yml:lcase(@name)»)) {
// no address available yet, try to find one
status = _own_identities_retrieve(session, &channels, PEP_idf_not_for_sync);
status = _own_identities_retrieve(session, &channels, PEP_idf_not_for_«yml:lcase(@name)»);
if (!status)
goto the_end;
break;
@ -372,7 +377,7 @@ tstylesheet {
channels->next = NULL;
}
else {
status = PEP_SYNC_NO_CHANNEL;
status = PEP_«yml:ucase(@name)»_NO_CHANNEL;
goto the_end;
}
}


+ 0
- 7
sync/sync.fsm View File

@ -29,8 +29,6 @@ protocol Sync 1 {
state Sole {
on Init {
do closeHandshakeDialog;
do clearState;
do openChallenge; // own challenge
send Beacon;
}
@ -216,11 +214,6 @@ protocol Sync 1 {
}
state Grouped {
on Init {
do closeHandshakeDialog;
do clearState;
}
on GroupKeys
do saveGroupKeys;


+ 27
- 11
test/src/engine_tests/SyncTests.cc View File

@ -6,7 +6,9 @@
#include "pEpEngine.h"
#include "sync_api.h"
#include "Sync_event.h"
#include "pEp_internal.h"
#include "KeySync_fsm.h"
#include "EngineTestSessionSuite.h"
#include "SyncTests.h"
@ -20,11 +22,11 @@ public:
utility::locked_queue< Sync_event_t * > q;
static PEP_STATUS notifyHandshake(
void *obj,
pEp_identity *me,
pEp_identity *partner,
sync_handshake_signal signal
)
void *obj,
pEp_identity *me,
pEp_identity *partner,
sync_handshake_signal signal
)
{
return PEP_STATUS_OK;
}
@ -41,6 +43,12 @@ public:
auto adapter = static_cast< Sync_Adapter *>(management);
return adapter->q.pop_front();
}
static PEP_STATUS messageToSend(void *obj, struct _message *msg)
{
assert(msg);
return PEP_STATUS_OK;
}
};
SyncTests::SyncTests(string suitename, string test_home_dir) :
@ -49,18 +57,26 @@ SyncTests::SyncTests(string suitename, string test_home_dir) :
static_cast<Func>(&SyncTests::check_sync)));
}
void SyncTests::check_sync() {
void SyncTests::check_sync()
{
Sync_Adapter adapter;
PEP_SESSION sync = NULL;
PEP_STATUS status = register_sync_callbacks(
session,
PEP_STATUS status = init(&sync, Sync_Adapter::messageToSend);
TEST_ASSERT(status == PEP_STATUS_OK);
status = register_sync_callbacks(
sync,
&adapter.q,
Sync_Adapter::notifyHandshake,
Sync_Adapter::inject_sync_event,
Sync_Adapter::retrieve_next_sync_event
);
TEST_ASSERT(status == PEP_STATUS_OK);
unregister_sync_callbacks(session);
TEST_ASSERT(sync->sync_state.keysync.state == Sole);
unregister_sync_callbacks(sync);
release(sync);
}

Loading…
Cancel
Save