Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions include/pico/fsm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/** \ingroup Protocol
* @file
* @author Claudio Dettoni <cd611@cl.cam.ac.uk>
* @version $(VERSION)
*
* @section LICENSE
*
* (C) Copyright Cambridge Authentication Ltd, 2017
*
* This file is part of libpico.
*
* Libpico is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* Libpico is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with libpico. If not, see
* <http://www.gnu.org/licenses/>.
*
*
* @section DESCRIPTION
*
* This file contains definitions that are common to fsmpico.h and fsmservice.h
*/

/** \addtogroup Protocol
* @{
*/

#ifndef __FSM_H
#define __FSM_H (1)

typedef void (*FsmWrite)(char const * data, size_t length, void * user_data);
typedef void (*FsmSetTimeout)(int timeout, void * user_data);
typedef void (*FsmError)(void * user_data);
typedef void (*FsmReconnect)(void * user_data);
typedef void (*FsmListen)(void * user_data);
typedef void (*FsmDisconnect)(void * user_data);
typedef void (*FsmAuthenticated)(int status, void * user_data);
typedef void (*FsmSessionEnded)(void * user_data);
typedef void (*FsmStatusUpdate)(int state, void * user_data);

#endif

/** @} addtogroup Protocol */
11 changes: 2 additions & 9 deletions include/pico/fsmpico.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
#ifndef __FSMPICO_H
#define __FSMPICO_H (1)

#include "pico/fsm.h"

// Defines

// Structure definitions
Expand Down Expand Up @@ -94,15 +96,6 @@ typedef enum _FSMPICOSTATE {
*/
typedef struct _FsmPico FsmPico;

typedef void (*FsmWrite)(char const * data, size_t length, void * user_data);
typedef void (*FsmSetTimeout)(int timeout, void * user_data);
typedef void (*FsmError)(void * user_data);
typedef void (*FsmReconnect)(void * user_data);
typedef void (*FsmDisconnect)(void * user_data);
typedef void (*FsmAuthenticated)(int status, void * user_data);
typedef void (*FsmSessionEnded)(void * user_data);
typedef void (*FsmStatusUpdate)(FSMPICOSTATE state, void * user_data);

// Function prototypes

// Set things up using these functions
Expand Down
10 changes: 1 addition & 9 deletions include/pico/fsmservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
#include "pico/shared.h"
#include "pico/users.h"
#include "pico/dllpublic.h"
#include "pico/fsm.h"

// Defines

Expand Down Expand Up @@ -102,15 +103,6 @@ typedef enum _FSMSERVICESTATE {
*/
typedef struct _FsmService FsmService;

typedef void (*FsmWrite)(char const * data, size_t length, void * user_data);
typedef void (*FsmSetTimeout)(int timeout, void * user_data);
typedef void (*FsmError)(void * user_data);
typedef void (*FsmDisconnect)(void * user_data);
typedef void (*FsmListen)(void * user_data);
typedef void (*FsmAuthenticated)(int status, void * user_data);
typedef void (*FsmSessionEnded)(void * user_data);
typedef void (*FsmStatusUpdate)(int state, void * user_data);

// Function prototypes

// Set things up using these functions
Expand Down
2 changes: 1 addition & 1 deletion tests/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AUTOMAKE_OPTIONS = subdir-objects

TESTS = test_base64 test_buffer test_cryptosupport test_sigmaverifier test_channel test_json test_users test_auth test_displayqr test_continuous test_beacons
TESTS = test_base64 test_buffer test_cryptosupport test_sigmaverifier test_channel test_json test_users test_auth test_displayqr test_continuous test_beacons test_fsm

noinst_LTLIBRARIES = lib_mockbt.la
lib_mockbt_la_SOURCES = \
Expand Down
28 changes: 23 additions & 5 deletions tests/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ TESTS = test_base64$(EXEEXT) test_buffer$(EXEEXT) \
test_cryptosupport$(EXEEXT) test_sigmaverifier$(EXEEXT) \
test_channel$(EXEEXT) test_json$(EXEEXT) test_users$(EXEEXT) \
test_auth$(EXEEXT) test_displayqr$(EXEEXT) \
test_continuous$(EXEEXT) test_beacons$(EXEEXT)
test_continuous$(EXEEXT) test_beacons$(EXEEXT) \
test_fsm$(EXEEXT)
check_PROGRAMS = $(am__EXEEXT_1)
subdir = tests
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
Expand Down Expand Up @@ -123,7 +124,8 @@ am__EXEEXT_1 = test_base64$(EXEEXT) test_buffer$(EXEEXT) \
test_cryptosupport$(EXEEXT) test_sigmaverifier$(EXEEXT) \
test_channel$(EXEEXT) test_json$(EXEEXT) test_users$(EXEEXT) \
test_auth$(EXEEXT) test_displayqr$(EXEEXT) \
test_continuous$(EXEEXT) test_beacons$(EXEEXT)
test_continuous$(EXEEXT) test_beacons$(EXEEXT) \
test_fsm$(EXEEXT)
test_auth_SOURCES = test_auth.c
test_auth_OBJECTS = test_auth.$(OBJEXT)
test_auth_LDADD = $(LDADD)
Expand Down Expand Up @@ -156,6 +158,10 @@ test_displayqr_SOURCES = test_displayqr.c
test_displayqr_OBJECTS = test_displayqr.$(OBJEXT)
test_displayqr_LDADD = $(LDADD)
test_displayqr_DEPENDENCIES = ../libpico.la .libs/lib_mockbt.la
test_fsm_SOURCES = test_fsm.c
test_fsm_OBJECTS = test_fsm.$(OBJEXT)
test_fsm_LDADD = $(LDADD)
test_fsm_DEPENDENCIES = ../libpico.la .libs/lib_mockbt.la
test_json_SOURCES = test_json.c
test_json_OBJECTS = test_json.$(OBJEXT)
test_json_LDADD = $(LDADD)
Expand Down Expand Up @@ -204,11 +210,11 @@ am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(lib_mockbt_la_SOURCES) test_auth.c test_base64.c \
test_beacons.c test_buffer.c test_channel.c test_continuous.c \
test_cryptosupport.c test_displayqr.c test_json.c \
test_cryptosupport.c test_displayqr.c test_fsm.c test_json.c \
test_sigmaverifier.c test_users.c
DIST_SOURCES = $(lib_mockbt_la_SOURCES) test_auth.c test_base64.c \
test_beacons.c test_buffer.c test_channel.c test_continuous.c \
test_cryptosupport.c test_displayqr.c test_json.c \
test_cryptosupport.c test_displayqr.c test_fsm.c test_json.c \
test_sigmaverifier.c test_users.c
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
Expand Down Expand Up @@ -574,7 +580,7 @@ lib_mockbt_la_SOURCES = \

lib_mockbt_la_CFLAGS = $(AM_CFLAGS) @PICOBT_CFLAGS@
AM_CFLAGS = -Wall -Werror -I"../include" -pthread @CHECK_CFLAGS@
LDADD = ../libpico.la .libs/lib_mockbt.la @CHECK_LIBS@ @PICOLIB_LIBS@
LDADD = ../libpico.la .libs/lib_mockbt.la @CHECK_LIBS@ @PICOLIB_LIBS@
all: all-am

.SUFFIXES:
Expand Down Expand Up @@ -672,6 +678,10 @@ test_displayqr$(EXEEXT): $(test_displayqr_OBJECTS) $(test_displayqr_DEPENDENCIES
@rm -f test_displayqr$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(test_displayqr_OBJECTS) $(test_displayqr_LDADD) $(LIBS)

test_fsm$(EXEEXT): $(test_fsm_OBJECTS) $(test_fsm_DEPENDENCIES) $(EXTRA_test_fsm_DEPENDENCIES)
@rm -f test_fsm$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(test_fsm_OBJECTS) $(test_fsm_LDADD) $(LIBS)

test_json$(EXEEXT): $(test_json_OBJECTS) $(test_json_DEPENDENCIES) $(EXTRA_test_json_DEPENDENCIES)
@rm -f test_json$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(test_json_OBJECTS) $(test_json_LDADD) $(LIBS)
Expand Down Expand Up @@ -700,6 +710,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_continuous.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_cryptosupport.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_displayqr.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_fsm.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_json.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_sigmaverifier.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_users.Po@am__quote@
Expand Down Expand Up @@ -1013,6 +1024,13 @@ test_beacons.log: test_beacons$(EXEEXT)
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
test_fsm.log: test_fsm$(EXEEXT)
@p='test_fsm$(EXEEXT)'; \
b='test_fsm'; \
$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
.test.log:
@p='$<'; \
$(am__set_b); \
Expand Down
Loading