Coverage Report

Created: 2026-03-07 06:40

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/S2OPC/src/ClientServer/services/b2c/user_bs.c
Line
Count
Source
1
/*
2
 * Licensed to Systerel under one or more contributor license
3
 * agreements. See the NOTICE file distributed with this work
4
 * for additional information regarding copyright ownership.
5
 * Systerel licenses this file to you under the Apache
6
 * License, Version 2.0 (the "License"); you may not use this
7
 * file except in compliance with the License. You may obtain
8
 * a copy of the License at
9
 *
10
 *   http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing,
13
 * software distributed under the License is distributed on an
14
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
 * KIND, either express or implied.  See the License for the
16
 * specific language governing permissions and limitations
17
 * under the License.
18
 */
19
20
#include "user_bs.h"
21
#include "sopc_assert.h"
22
#include "sopc_macros.h"
23
24
/*--------------
25
   SEES Clause
26
  --------------*/
27
#include "constants.h"
28
29
/*------------------------
30
   INITIALISATION Clause
31
  ------------------------*/
32
void user_bs__INITIALISATION(void)
33
0
{ /*Translated from B but an intialisation is not needed from this module.*/
34
0
}
35
36
/*--------------------
37
   OPERATIONS Clause
38
  --------------------*/
39
extern void user_bs__are_username_equal(const constants__t_user_i user_bs__p_user,
40
                                        const constants__t_Criteria_i user_bs__p_username,
41
                                        t_bool* const user_bs__b_res)
42
0
{
43
0
    SOPC_ASSERT(NULL != user_bs__b_res);
44
0
    SOPC_ASSERT(true == SOPC_User_IsUsername(SOPC_UserWithAuthorization_GetUser(user_bs__p_user)));
45
0
    const SOPC_User* user = SOPC_UserWithAuthorization_GetUser(user_bs__p_user);
46
0
    const SOPC_String* username = SOPC_User_GetUsername(user);
47
0
    int32_t comparison = -1;
48
0
    SOPC_ReturnStatus status = SOPC_String_Compare(username, user_bs__p_username, false, &comparison);
49
0
    if (0 == comparison && SOPC_STATUS_OK == status)
50
0
    {
51
0
        *user_bs__b_res = true;
52
0
    }
53
0
    else
54
0
    {
55
0
        *user_bs__b_res = false;
56
0
    }
57
0
}
58
59
extern void user_bs__is_anonymous(const constants__t_user_i user_bs__p_user, t_bool* const user_bs__b_res)
60
0
{
61
0
    SOPC_ASSERT(NULL != user_bs__b_res);
62
0
    const SOPC_User* user = SOPC_UserWithAuthorization_GetUser(user_bs__p_user);
63
0
    *user_bs__b_res = SOPC_User_IsAnonymous(user);
64
0
}
65
66
extern void user_bs__is_username(const constants__t_user_i user_bs__p_user, t_bool* const user_bs__b_res)
67
0
{
68
0
    SOPC_ASSERT(NULL != user_bs__b_res);
69
0
    const SOPC_User* user = SOPC_UserWithAuthorization_GetUser(user_bs__p_user);
70
0
    *user_bs__b_res = SOPC_User_IsUsername(user);
71
0
}