sync/generated/sync_send_actions.c
author Krista Bennett <krista@pep-project.org>
Mon, 20 Nov 2017 16:04:50 +0100
branchENGINE-289
changeset 2287 026ab4dae779
parent 1627 bf605dd7b705
parent 2271 25bfd109320c
permissions -rw-r--r--
merged in default
krista@2271
     1
// Send Actions for DeviceState state machine
krista@2271
     2
krista@2271
     3
#include <assert.h>
krista@2271
     4
#include "pEp_internal.h"
krista@2271
     5
#include "keymanagement.h"
krista@2271
     6
#include "message.h"
krista@2271
     7
#include "sync_fsm.h"
krista@2271
     8
#include "baseprotocol.h"
krista@2271
     9
#include "map_asn1.h"
krista@2271
    10
#include "../asn.1/DeviceGroup-Protocol.h"
krista@2271
    11
#include "sync_impl.h"
krista@2271
    12
#include "../asn.1/Beacon.h"
krista@2271
    13
#include "../asn.1/HandshakeRequest.h"
krista@2271
    14
#include "../asn.1/GroupKeys.h"
krista@2271
    15
#include "../asn.1/GroupUpdate.h"
krista@2271
    16
#include "../asn.1/UpdateRequest.h"
krista@2271
    17
krista@2271
    18
krista@2271
    19
// sendBeacon() - send Beacon message
krista@2271
    20
//
krista@2271
    21
//  params:
krista@2271
    22
//      session (in)        session handle
krista@2271
    23
//      state (in)          state the state machine is in
krista@2271
    24
//      partner (in)        (must be NULL)
krista@2271
    25
//
krista@2271
    26
//  returns:
krista@2271
    27
//      PEP_STATUS_OK or any other value on error
krista@2271
    28
krista@2271
    29
PEP_STATUS sendBeacon(
krista@2271
    30
        PEP_SESSION session,
krista@2271
    31
        DeviceState_state state,
krista@2271
    32
        Identity partner,
krista@2271
    33
        void *extra
krista@2271
    34
    )
krista@2271
    35
{
krista@2271
    36
    assert(session && state);
krista@2271
    37
    if (!(session && state))
krista@2271
    38
        return PEP_ILLEGAL_VALUE;
krista@2271
    39
krista@2271
    40
    PEP_STATUS status = PEP_STATUS_OK;
krista@2271
    41
krista@2271
    42
    DeviceGroup_Protocol_t *msg = new_DeviceGroup_Protocol_msg(DeviceGroup_Protocol__payload_PR_beacon);
krista@2271
    43
    if (!msg)
krista@2271
    44
        goto enomem;
krista@2271
    45
krista@2271
    46
    bool encrypted = false;
krista@2271
    47
    status = multicast_self_msg(session, state, msg, encrypted);
krista@2271
    48
    if (status != PEP_STATUS_OK)
krista@2271
    49
        goto error;
krista@2271
    50
krista@2271
    51
    free_DeviceGroup_Protocol_msg(msg);
krista@2271
    52
    return PEP_STATUS_OK;
krista@2271
    53
krista@2271
    54
enomem:
krista@2271
    55
    status = PEP_OUT_OF_MEMORY;
krista@2271
    56
error:
krista@2271
    57
    free_DeviceGroup_Protocol_msg(msg);
krista@2271
    58
    return status;
krista@2271
    59
}
krista@2271
    60
krista@2271
    61
krista@2271
    62
// sendHandshakeRequest() - send HandshakeRequest message
krista@2271
    63
//
krista@2271
    64
//  params:
krista@2271
    65
//      session (in)        session handle
krista@2271
    66
//      state (in)          state the state machine is in
krista@2271
    67
//      partner (in)        partner to communicate with
krista@2271
    68
//
krista@2271
    69
//  returns:
krista@2271
    70
//      PEP_STATUS_OK or any other value on error
krista@2271
    71
krista@2271
    72
PEP_STATUS sendHandshakeRequest(
krista@2271
    73
        PEP_SESSION session,
krista@2271
    74
        DeviceState_state state,
krista@2271
    75
        Identity partner,
krista@2271
    76
        void *extra
krista@2271
    77
    )
krista@2271
    78
{
krista@2271
    79
    assert(session && state);
krista@2271
    80
    if (!(session && state))
krista@2271
    81
        return PEP_ILLEGAL_VALUE;
krista@2271
    82
krista@2271
    83
    PEP_STATUS status = PEP_STATUS_OK;
krista@2271
    84
krista@2271
    85
    DeviceGroup_Protocol_t *msg = new_DeviceGroup_Protocol_msg(DeviceGroup_Protocol__payload_PR_handshakeRequest);
krista@2271
    86
    if (!msg)
krista@2271
    87
        goto enomem;
krista@2271
    88
krista@2271
    89
    msg->payload.choice.handshakeRequest.partner_id = 
krista@2271
    90
        OCTET_STRING_new_fromBuf(&asn_DEF_UTF8String,
krista@2271
    91
                                 partner->user_id, -1);
krista@2271
    92
    if (partner->user_id && !msg->payload.choice.handshakeRequest.partner_id)
krista@2271
    93
       goto enomem;
krista@2271
    94
krista@2271
    95
    char *devgrp = NULL;
krista@2271
    96
    status = get_device_group(session, &devgrp);
krista@2271
    97
    if (status == PEP_STATUS_OK && devgrp && devgrp[0])
krista@2271
    98
    msg->payload.choice.handshakeRequest.group_id = 
krista@2271
    99
        OCTET_STRING_new_fromBuf(&asn_DEF_UTF8String,
krista@2271
   100
                                 devgrp, -1);
krista@2271
   101
    free(devgrp);
krista@2271
   102
    if (devgrp && !msg->payload.choice.handshakeRequest.partner_id)
krista@2271
   103
       goto enomem;
krista@2271
   104
krista@2271
   105
    bool encrypted = true;
krista@2271
   106
    status = unicast_msg(session, partner, state, msg, encrypted);
krista@2271
   107
    if (status != PEP_STATUS_OK)
krista@2271
   108
        goto error;
krista@2271
   109
krista@2271
   110
    free_DeviceGroup_Protocol_msg(msg);
krista@2271
   111
    return PEP_STATUS_OK;
krista@2271
   112
krista@2271
   113
enomem:
krista@2271
   114
    status = PEP_OUT_OF_MEMORY;
krista@2271
   115
error:
krista@2271
   116
    free_DeviceGroup_Protocol_msg(msg);
krista@2271
   117
    return status;
krista@2271
   118
}
krista@2271
   119
krista@2271
   120
krista@2271
   121
// sendGroupKeys() - send GroupKeys message
krista@2271
   122
//
krista@2271
   123
//  params:
krista@2271
   124
//      session (in)        session handle
krista@2271
   125
//      state (in)          state the state machine is in
krista@2271
   126
//      partner (in)        partner to communicate with
krista@2271
   127
//
krista@2271
   128
//  returns:
krista@2271
   129
//      PEP_STATUS_OK or any other value on error
krista@2271
   130
krista@2271
   131
PEP_STATUS sendGroupKeys(
krista@2271
   132
        PEP_SESSION session,
krista@2271
   133
        DeviceState_state state,
krista@2271
   134
        Identity partner,
krista@2271
   135
        void *extra
krista@2271
   136
    )
krista@2271
   137
{
krista@2271
   138
    assert(session && state);
krista@2271
   139
    if (!(session && state))
krista@2271
   140
        return PEP_ILLEGAL_VALUE;
krista@2271
   141
krista@2271
   142
    PEP_STATUS status = PEP_STATUS_OK;
krista@2271
   143
    identity_list *kl = new_identity_list(NULL);
krista@2271
   144
krista@2271
   145
    DeviceGroup_Protocol_t *msg = new_DeviceGroup_Protocol_msg(DeviceGroup_Protocol__payload_PR_groupKeys);
krista@2271
   146
    if (!msg)
krista@2271
   147
        goto enomem;
krista@2271
   148
krista@2271
   149
    status = _own_identities_retrieve(session, &kl, PEP_idf_not_for_sync);
krista@2271
   150
    if (status != PEP_STATUS_OK)
krista@2271
   151
        goto error;
krista@2271
   152
    if (IdentityList_from_identity_list(kl, &msg->payload.choice.groupKeys.ownIdentities) == NULL)
krista@2271
   153
        goto enomem;
krista@2271
   154
krista@2271
   155
    msg->payload.choice.groupKeys.partner_id = 
krista@2271
   156
        OCTET_STRING_new_fromBuf(&asn_DEF_UTF8String,
krista@2271
   157
                                 partner->user_id, -1);
krista@2271
   158
    if (partner->user_id && !msg->payload.choice.groupKeys.partner_id)
krista@2271
   159
       goto enomem;
krista@2271
   160
krista@2271
   161
    char *devgrp = NULL;
krista@2271
   162
    status = get_device_group(session, &devgrp);
krista@2271
   163
    if (status == PEP_STATUS_OK && devgrp && devgrp[0])
krista@2271
   164
    msg->payload.choice.groupKeys.group_id = 
krista@2271
   165
        OCTET_STRING_new_fromBuf(&asn_DEF_UTF8String,
krista@2271
   166
                                 devgrp, -1);
krista@2271
   167
    free(devgrp);
krista@2271
   168
    if (devgrp && !msg->payload.choice.groupKeys.partner_id)
krista@2271
   169
       goto enomem;
krista@2271
   170
krista@2271
   171
    bool encrypted = true;
krista@2271
   172
    status = unicast_msg(session, partner, state, msg, encrypted);
krista@2271
   173
    if (status != PEP_STATUS_OK)
krista@2271
   174
        goto error;
krista@2271
   175
krista@2271
   176
    free_identity_list(kl);
krista@2271
   177
    free_DeviceGroup_Protocol_msg(msg);
krista@2271
   178
    return PEP_STATUS_OK;
krista@2271
   179
krista@2271
   180
enomem:
krista@2271
   181
    status = PEP_OUT_OF_MEMORY;
krista@2271
   182
error:
krista@2271
   183
    free_DeviceGroup_Protocol_msg(msg);
krista@2271
   184
    free_identity_list(kl);
krista@2271
   185
    return status;
krista@2271
   186
}
krista@2271
   187
krista@2271
   188
krista@2271
   189
// sendGroupUpdate() - send GroupUpdate message
krista@2271
   190
//
krista@2271
   191
//  params:
krista@2271
   192
//      session (in)        session handle
krista@2271
   193
//      state (in)          state the state machine is in
krista@2271
   194
//      partner (in)        (must be NULL)
krista@2271
   195
//
krista@2271
   196
//  returns:
krista@2271
   197
//      PEP_STATUS_OK or any other value on error
krista@2271
   198
krista@2271
   199
PEP_STATUS sendGroupUpdate(
krista@2271
   200
        PEP_SESSION session,
krista@2271
   201
        DeviceState_state state,
krista@2271
   202
        Identity partner,
krista@2271
   203
        void *extra
krista@2271
   204
    )
krista@2271
   205
{
krista@2271
   206
    assert(session && state);
krista@2271
   207
    if (!(session && state))
krista@2271
   208
        return PEP_ILLEGAL_VALUE;
krista@2271
   209
krista@2271
   210
    PEP_STATUS status = PEP_STATUS_OK;
krista@2271
   211
    identity_list *kl = new_identity_list(NULL);
krista@2271
   212
krista@2271
   213
    DeviceGroup_Protocol_t *msg = new_DeviceGroup_Protocol_msg(DeviceGroup_Protocol__payload_PR_groupUpdate);
krista@2271
   214
    if (!msg)
krista@2271
   215
        goto enomem;
krista@2271
   216
krista@2271
   217
    status = _own_identities_retrieve(session, &kl, PEP_idf_not_for_sync);
krista@2271
   218
    if (status != PEP_STATUS_OK)
krista@2271
   219
        goto error;
krista@2271
   220
    if (IdentityList_from_identity_list(kl, &msg->payload.choice.groupUpdate.ownIdentities) == NULL)
krista@2271
   221
        goto enomem;
krista@2271
   222
krista@2271
   223
    bool encrypted = true;
krista@2271
   224
    status = multicast_self_msg(session, state, msg, encrypted);
krista@2271
   225
    if (status != PEP_STATUS_OK)
krista@2271
   226
        goto error;
krista@2271
   227
krista@2271
   228
    free_identity_list(kl);
krista@2271
   229
    free_DeviceGroup_Protocol_msg(msg);
krista@2271
   230
    return PEP_STATUS_OK;
krista@2271
   231
krista@2271
   232
enomem:
krista@2271
   233
    status = PEP_OUT_OF_MEMORY;
krista@2271
   234
error:
krista@2271
   235
    free_DeviceGroup_Protocol_msg(msg);
krista@2271
   236
    return status;
krista@2271
   237
}
krista@2271
   238
krista@2271
   239
krista@2271
   240
// sendUpdateRequest() - send UpdateRequest message
krista@2271
   241
//
krista@2271
   242
//  params:
krista@2271
   243
//      session (in)        session handle
krista@2271
   244
//      state (in)          state the state machine is in
krista@2271
   245
//      partner (in)        (must be NULL)
krista@2271
   246
//
krista@2271
   247
//  returns:
krista@2271
   248
//      PEP_STATUS_OK or any other value on error
krista@2271
   249
krista@2271
   250
PEP_STATUS sendUpdateRequest(
krista@2271
   251
        PEP_SESSION session,
krista@2271
   252
        DeviceState_state state,
krista@2271
   253
        Identity partner,
krista@2271
   254
        void *extra
krista@2271
   255
    )
krista@2271
   256
{
krista@2271
   257
    assert(session && state);
krista@2271
   258
    if (!(session && state))
krista@2271
   259
        return PEP_ILLEGAL_VALUE;
krista@2271
   260
krista@2271
   261
    PEP_STATUS status = PEP_STATUS_OK;
krista@2271
   262
krista@2271
   263
    DeviceGroup_Protocol_t *msg = new_DeviceGroup_Protocol_msg(DeviceGroup_Protocol__payload_PR_updateRequest);
krista@2271
   264
    if (!msg)
krista@2271
   265
        goto enomem;
krista@2271
   266
krista@2271
   267
    bool encrypted = true;
krista@2271
   268
    status = multicast_self_msg(session, state, msg, encrypted);
krista@2271
   269
    if (status != PEP_STATUS_OK)
krista@2271
   270
        goto error;
krista@2271
   271
krista@2271
   272
    free_DeviceGroup_Protocol_msg(msg);
krista@2271
   273
    return PEP_STATUS_OK;
krista@2271
   274
krista@2271
   275
enomem:
krista@2271
   276
    status = PEP_OUT_OF_MEMORY;
krista@2271
   277
error:
krista@2271
   278
    free_DeviceGroup_Protocol_msg(msg);
krista@2271
   279
    return status;
krista@2271
   280
}
krista@2271
   281
krista@2271
   282
krista@2271
   283
PEP_STATUS _notifyHandshake(
krista@2271
   284
        PEP_SESSION session,
krista@2271
   285
        Identity partner,
krista@2271
   286
        sync_handshake_signal signal
krista@2271
   287
    );
krista@2271
   288
krista@2271
   289
// notifyInitFormGroup() - notify InitFormGroup to app
krista@2271
   290
//
krista@2271
   291
//  params:
krista@2271
   292
//      session (in)        session handle
krista@2271
   293
//      state (in)          state the state machine is in
krista@2271
   294
//      partner (in)        partner to communicate with
krista@2271
   295
//
krista@2271
   296
//  returns:
krista@2271
   297
//      PEP_STATUS_OK or any other value on error
krista@2271
   298
krista@2271
   299
PEP_STATUS notifyInitFormGroup(
krista@2271
   300
        PEP_SESSION session,
krista@2271
   301
        DeviceState_state state,
krista@2271
   302
        Identity partner,
krista@2271
   303
        void *extra
krista@2271
   304
    )
krista@2271
   305
{
krista@2271
   306
    assert(session && state);
krista@2271
   307
    assert(extra == NULL);
krista@2271
   308
    if (!(session && state && extra == NULL))
krista@2271
   309
        return PEP_ILLEGAL_VALUE;
krista@2271
   310
krista@2271
   311
    return _notifyHandshake(session, partner, SYNC_NOTIFY_INIT_FORM_GROUP);
krista@2271
   312
}
krista@2271
   313
krista@2271
   314
krista@2271
   315
// notifyInitAddOurDevice() - notify InitAddOurDevice to app
krista@2271
   316
//
krista@2271
   317
//  params:
krista@2271
   318
//      session (in)        session handle
krista@2271
   319
//      state (in)          state the state machine is in
krista@2271
   320
//      partner (in)        partner to communicate with
krista@2271
   321
//
krista@2271
   322
//  returns:
krista@2271
   323
//      PEP_STATUS_OK or any other value on error
krista@2271
   324
krista@2271
   325
PEP_STATUS notifyInitAddOurDevice(
krista@2271
   326
        PEP_SESSION session,
krista@2271
   327
        DeviceState_state state,
krista@2271
   328
        Identity partner,
krista@2271
   329
        void *extra
krista@2271
   330
    )
krista@2271
   331
{
krista@2271
   332
    assert(session && state);
krista@2271
   333
    assert(extra == NULL);
krista@2271
   334
    if (!(session && state && extra == NULL))
krista@2271
   335
        return PEP_ILLEGAL_VALUE;
krista@2271
   336
krista@2271
   337
    return _notifyHandshake(session, partner, SYNC_NOTIFY_INIT_ADD_OUR_DEVICE);
krista@2271
   338
}
krista@2271
   339
krista@2271
   340
krista@2271
   341
// notifyAcceptedGroupCreated() - notify AcceptedGroupCreated to app
krista@2271
   342
//
krista@2271
   343
//  params:
krista@2271
   344
//      session (in)        session handle
krista@2271
   345
//      state (in)          state the state machine is in
krista@2271
   346
//      partner (in)        partner to communicate with
krista@2271
   347
//
krista@2271
   348
//  returns:
krista@2271
   349
//      PEP_STATUS_OK or any other value on error
krista@2271
   350
krista@2271
   351
PEP_STATUS notifyAcceptedGroupCreated(
krista@2271
   352
        PEP_SESSION session,
krista@2271
   353
        DeviceState_state state,
krista@2271
   354
        Identity partner,
krista@2271
   355
        void *extra
krista@2271
   356
    )
krista@2271
   357
{
krista@2271
   358
    assert(session && state);
krista@2271
   359
    assert(extra == NULL);
krista@2271
   360
    if (!(session && state && extra == NULL))
krista@2271
   361
        return PEP_ILLEGAL_VALUE;
krista@2271
   362
krista@2271
   363
    return _notifyHandshake(session, partner, SYNC_NOTIFY_ACCEPTED_GROUP_CREATED);
krista@2271
   364
}
krista@2271
   365
krista@2271
   366
krista@2271
   367
// notifyTimeout() - notify Timeout to app
krista@2271
   368
//
krista@2271
   369
//  params:
krista@2271
   370
//      session (in)        session handle
krista@2271
   371
//      state (in)          state the state machine is in
krista@2271
   372
//      partner (in)        partner to communicate with
krista@2271
   373
//
krista@2271
   374
//  returns:
krista@2271
   375
//      PEP_STATUS_OK or any other value on error
krista@2271
   376
krista@2271
   377
PEP_STATUS notifyTimeout(
krista@2271
   378
        PEP_SESSION session,
krista@2271
   379
        DeviceState_state state,
krista@2271
   380
        Identity partner,
krista@2271
   381
        void *extra
krista@2271
   382
    )
krista@2271
   383
{
krista@2271
   384
    assert(session && state);
krista@2271
   385
    assert(extra == NULL);
krista@2271
   386
    if (!(session && state && extra == NULL))
krista@2271
   387
        return PEP_ILLEGAL_VALUE;
krista@2271
   388
krista@2271
   389
    return _notifyHandshake(session, partner, SYNC_NOTIFY_TIMEOUT);
krista@2271
   390
}
krista@2271
   391
krista@2271
   392
krista@2271
   393
// notifyAcceptedDeviceAdded() - notify AcceptedDeviceAdded to app
krista@2271
   394
//
krista@2271
   395
//  params:
krista@2271
   396
//      session (in)        session handle
krista@2271
   397
//      state (in)          state the state machine is in
krista@2271
   398
//      partner (in)        partner to communicate with
krista@2271
   399
//
krista@2271
   400
//  returns:
krista@2271
   401
//      PEP_STATUS_OK or any other value on error
krista@2271
   402
krista@2271
   403
PEP_STATUS notifyAcceptedDeviceAdded(
krista@2271
   404
        PEP_SESSION session,
krista@2271
   405
        DeviceState_state state,
krista@2271
   406
        Identity partner,
krista@2271
   407
        void *extra
krista@2271
   408
    )
krista@2271
   409
{
krista@2271
   410
    assert(session && state);
krista@2271
   411
    assert(extra == NULL);
krista@2271
   412
    if (!(session && state && extra == NULL))
krista@2271
   413
        return PEP_ILLEGAL_VALUE;
krista@2271
   414
krista@2271
   415
    return _notifyHandshake(session, partner, SYNC_NOTIFY_ACCEPTED_DEVICE_ADDED);
krista@2271
   416
}
krista@2271
   417
krista@2271
   418
krista@2271
   419
// notifyInitAddOtherDevice() - notify InitAddOtherDevice to app
krista@2271
   420
//
krista@2271
   421
//  params:
krista@2271
   422
//      session (in)        session handle
krista@2271
   423
//      state (in)          state the state machine is in
krista@2271
   424
//      partner (in)        partner to communicate with
krista@2271
   425
//
krista@2271
   426
//  returns:
krista@2271
   427
//      PEP_STATUS_OK or any other value on error
krista@2271
   428
krista@2271
   429
PEP_STATUS notifyInitAddOtherDevice(
krista@2271
   430
        PEP_SESSION session,
krista@2271
   431
        DeviceState_state state,
krista@2271
   432
        Identity partner,
krista@2271
   433
        void *extra
krista@2271
   434
    )
krista@2271
   435
{
krista@2271
   436
    assert(session && state);
krista@2271
   437
    assert(extra == NULL);
krista@2271
   438
    if (!(session && state && extra == NULL))
krista@2271
   439
        return PEP_ILLEGAL_VALUE;
krista@2271
   440
krista@2271
   441
    return _notifyHandshake(session, partner, SYNC_NOTIFY_INIT_ADD_OTHER_DEVICE);
krista@2271
   442
}
krista@2271
   443
krista@2271
   444
krista@2271
   445
// notifyInitMoveOurDevice() - notify InitMoveOurDevice to app
krista@2271
   446
//
krista@2271
   447
//  params:
krista@2271
   448
//      session (in)        session handle
krista@2271
   449
//      state (in)          state the state machine is in
krista@2271
   450
//      partner (in)        partner to communicate with
krista@2271
   451
//
krista@2271
   452
//  returns:
krista@2271
   453
//      PEP_STATUS_OK or any other value on error
krista@2271
   454
krista@2271
   455
PEP_STATUS notifyInitMoveOurDevice(
krista@2271
   456
        PEP_SESSION session,
krista@2271
   457
        DeviceState_state state,
krista@2271
   458
        Identity partner,
krista@2271
   459
        void *extra
krista@2271
   460
    )
krista@2271
   461
{
krista@2271
   462
    assert(session && state);
krista@2271
   463
    assert(extra == NULL);
krista@2271
   464
    if (!(session && state && extra == NULL))
krista@2271
   465
        return PEP_ILLEGAL_VALUE;
krista@2271
   466
krista@2271
   467
    return _notifyHandshake(session, partner, SYNC_NOTIFY_INIT_MOVE_OUR_DEVICE);
krista@2271
   468
}
krista@2271
   469
krista@2271
   470
krista@2271
   471
// notifyOvertaken() - notify Overtaken to app
krista@2271
   472
//
krista@2271
   473
//  params:
krista@2271
   474
//      session (in)        session handle
krista@2271
   475
//      state (in)          state the state machine is in
krista@2271
   476
//      partner (in)        partner to communicate with
krista@2271
   477
//
krista@2271
   478
//  returns:
krista@2271
   479
//      PEP_STATUS_OK or any other value on error
krista@2271
   480
krista@2271
   481
PEP_STATUS notifyOvertaken(
krista@2271
   482
        PEP_SESSION session,
krista@2271
   483
        DeviceState_state state,
krista@2271
   484
        Identity partner,
krista@2271
   485
        void *extra
krista@2271
   486
    )
krista@2271
   487
{
krista@2271
   488
    assert(session && state);
krista@2271
   489
    assert(extra == NULL);
krista@2271
   490
    if (!(session && state && extra == NULL))
krista@2271
   491
        return PEP_ILLEGAL_VALUE;
krista@2271
   492
krista@2271
   493
    return _notifyHandshake(session, partner, SYNC_NOTIFY_OVERTAKEN);
krista@2271
   494
}
krista@2271
   495
krista@2271
   496
krista@2271
   497
// notifyAcceptedDeviceMoved() - notify AcceptedDeviceMoved to app
krista@2271
   498
//
krista@2271
   499
//  params:
krista@2271
   500
//      session (in)        session handle
krista@2271
   501
//      state (in)          state the state machine is in
krista@2271
   502
//      partner (in)        partner to communicate with
krista@2271
   503
//
krista@2271
   504
//  returns:
krista@2271
   505
//      PEP_STATUS_OK or any other value on error
krista@2271
   506
krista@2271
   507
PEP_STATUS notifyAcceptedDeviceMoved(
krista@2271
   508
        PEP_SESSION session,
krista@2271
   509
        DeviceState_state state,
krista@2271
   510
        Identity partner,
krista@2271
   511
        void *extra
krista@2271
   512
    )
krista@2271
   513
{
krista@2271
   514
    assert(session && state);
krista@2271
   515
    assert(extra == NULL);
krista@2271
   516
    if (!(session && state && extra == NULL))
krista@2271
   517
        return PEP_ILLEGAL_VALUE;
krista@2271
   518
krista@2271
   519
    return _notifyHandshake(session, partner, SYNC_NOTIFY_ACCEPTED_DEVICE_MOVED);
krista@2271
   520
}
krista@2271
   521