Debian Codegraph @

src/vendor/azure-uamqp-c/devdoc/sasl_anonymous_requirements.md

raw
1 # `sasl_anonymous` requirements
2
3 ## Overview
4
5 `sasl_anonymous` is a module that implements the sasl mechanism ANONYMOUS so that it can be used through the `sasl_mechanism` interface.
6
7 ## Exposed API
8
9 ```C
10 MOCKABLE_FUNCTION(, const SASL_MECHANISM_INTERFACE_DESCRIPTION*, saslanonymous_get_interface);
11 ```
12
13 ### saslanonymous_create
14
15 ```C
16 CONCRETE_SASL_MECHANISM_HANDLE saslanonymous_create(void* config);
17 ```
18
19 `saslanonymous_create` is the implementation provided via `saslanonymous_get_interface` for the `concrete_sasl_mechanism_create` member.
20
21 **SRS_SASL_ANONYMOUS_01_001: [**`saslanonymous_create` shall return on success a non-NULL handle to a new SASL anonymous mechanism.**]**
22
23 **SRS_SASL_ANONYMOUS_01_002: [**If allocating the memory needed for the SASL anonymous instance fails then `saslanonymous_create` shall return NULL.**]**
24
25 **SRS_SASL_ANONYMOUS_01_003: [**Since this is the ANONYMOUS SASL mechanism, `config` shall be ignored.**]**
26
27 ### saslanonymous_destroy
28
29 ```C
30 void saslanonymous_destroy(CONCRETE_SASL_MECHANISM_HANDLE concrete_sasl_mechanism);
31 ```
32
33 `saslanonymous_destroy` is the implementation provided via `saslanonymous_get_interface` for the `concrete_sasl_mechanism_destroy` member.
34
35 **SRS_SASL_ANONYMOUS_01_004: [**`saslanonymous_destroy` shall free all resources associated with the SASL mechanism.**]**
36
37 **SRS_SASL_ANONYMOUS_01_005: [**If the argument `concrete_sasl_mechanism` is NULL, `saslanonymous_destroy` shall do nothing.**]**
38
39 ### saslanonymous_get_init_bytes
40
41 ```C
42 int saslanonymous_get_init_bytes(CONCRETE_SASL_MECHANISM_HANDLE concrete_sasl_mechanism, INIT_BYTES* init_bytes);
43 ```
44
45 `saslanonymous_get_init_bytes` is the implementation provided via `saslanonymous_get_interface` for the `concrete_sasl_mechanism_get_init_bytes` member.
46
47 **SRS_SASL_ANONYMOUS_01_006: [**`saslanonymous_get_init_bytes` shall validate the `concrete_sasl_mechanism` argument and set the length of the `init_bytes` argument to be zero.**]**
48
49 **SRS_SASL_ANONYMOUS_01_011: [**On success `saslanonymous_get_init_bytes` shall return zero.**]**
50
51 **SRS_SASL_ANONYMOUS_01_012: [**The bytes field of `init_buffer` shall be set to NULL.**]**
52
53 **SRS_SASL_ANONYMOUS_01_007: [**If any argument is NULL, `saslanonymous_get_init_bytes` shall return a non-zero value.**]**
54
55 ### saslanonymous_get_mechanism_name
56
57 ```C
58 const char* saslanonymous_get_mechanism_name(CONCRETE_SASL_MECHANISM_HANDLE concrete_sasl_mechanism);
59 ```
60
61 `saslanonymous_get_mechanism_name` is the implementation provided via `saslanonymous_get_interface` for the `concrete_sasl_mechanism_get_mechanism_name` member.
62
63 **SRS_SASL_ANONYMOUS_01_008: [**`saslanonymous_get_mechanism_name` shall validate the argument `concrete_sasl_mechanism` and on success it shall return a pointer to the string `ANONYMOUS`.**]**
64
65 **SRS_SASL_ANONYMOUS_01_009: [**If the argument `concrete_sasl_mechanism` is NULL, `saslanonymous_get_mechanism_name` shall return NULL.**]**
66
67 ### saslanonymous_challenge
68
69 ```C
70 int saslanonymous_challenge(CONCRETE_SASL_MECHANISM_HANDLE concrete_sasl_mechanism, const SASL_MECHANISM_BYTES* challenge_bytes, SASL_MECHANISM_BYTES* response_bytes);
71 ```
72
73 `saslanonymous_challenge` is the implementation provided via `saslanonymous_get_interface` for the `concrete_sasl_mechanism_challenge` member.
74
75 **SRS_SASL_ANONYMOUS_01_013: [**`saslanonymous_challenge` shall set the `buffer` field to NULL and `size` to 0 in the `response_bytes` argument as the ANONYMOUS SASL mechanism does not implement challenge/response.**]**
76
77 **SRS_SASL_ANONYMOUS_01_014: [**On success, `saslanonymous_challenge` shall return 0.**]**
78
79 **SRS_SASL_ANONYMOUS_01_015: [**If the `concrete_sasl_mechanism` or `response_bytes` argument is NULL then `saslanonymous_challenge` shall fail and return a non-zero value.**]**
80
81 ### saslanonymous_get_interface
82
83 ```C
84 MOCKABLE_FUNCTION(, const SASL_MECHANISM_INTERFACE_DESCRIPTION*, saslanonymous_get_interface);
85 ```
86
87 **SRS_SASL_ANONYMOUS_01_010: [**`saslanonymous_get_interface` shall return a pointer to a `SASL_MECHANISM_INTERFACE_DESCRIPTION` structure that contains pointers to the functions: `saslanonymous_create`, `saslanonymous_destroy`, `saslanonymous_get_init_bytes`, `saslanonymous_get_mechanism_name`, `saslanonymous_challenge`.**]**