Debian Codegraph @

src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/devdoc/memory_data_requirements.md

raw
1 # memory data
2 ====
3
4 ## Overview
5
6 `memory_data` is a module that reads/writes 8/16/32/64 bytes from memory to/from int8_t/int16_t/int32_t/int64_t and their unsigned versions.
7 `memory_data` does not perform any NULL checks on the arguments. It is intended to behave like other memory manipulation functions from the C standard (memcpy, etc.) and thus the address 0 is not treated in any special way.
8
9 ## Exposed API
10
11 ```c
12 MOCKABLE_INTERFACE(memory_data,
13 FUNCTION(, void, read_uint8_t, const unsigned char*, source, uint8_t*, destination),
14 FUNCTION(, void, read_uint16_t, const unsigned char*, source, uint16_t*, destination),
15 FUNCTION(, void, read_uint32_t, const unsigned char*, source, uint32_t*, destination),
16 FUNCTION(, void, read_uint64_t, const unsigned char*, source, uint64_t*, destination),
17
18 FUNCTION(, void, read_int8_t, const unsigned char*, source, int8_t*, destination),
19 FUNCTION(, void, read_int16_t, const unsigned char*, source, int16_t*, destination),
20 FUNCTION(, void, read_int32_t, const unsigned char*, source, int32_t*, destination),
21 FUNCTION(, void, read_int64_t, const unsigned char*, source, int64_t*, destination),
22
23 FUNCTION(, void, read_uuid_t, const unsigned char*, source, UUID_T*, destination),
24
25 FUNCTION(, void, write_uint8_t, unsigned char*, destination, uint8_t, value),
26 FUNCTION(, void, write_uint16_t, unsigned char*, destination, uint16_t, value),
27 FUNCTION(, void, write_uint32_t, unsigned char*, destination, uint32_t, value),
28 FUNCTION(, void, write_uint64_t, unsigned char*, destination, uint64_t, value),
29
30 FUNCTION(, void, write_int8_t, unsigned char*, destination, int8_t, value),
31 FUNCTION(, void, write_int16_t, unsigned char*, destination, int16_t, value),
32 FUNCTION(, void, write_int32_t, unsigned char*, destination, int32_t, value),
33 FUNCTION(, void, write_int64_t, unsigned char*, destination, int64_t, value),
34
35 FUNCTION(, void, write_uuid_t, unsigned char*, destination, const UUID_T, value)
36 )
37 ```
38
39 ### read_uint8_t
40 ```cs
41 FUNCTION(, void, read_uint8_t, const unsigned char*, source, uint8_t* destination);
42 ```
43
44 `read_uint8_t` reads a uint8_t from `source` and writes it into `destination`.
45
46 **SRS_MEMORY_DATA_02_041: [** `read_uint8_t` shall write in `destination` the byte at `source` **]**
47
48 ### read_uint16_t
49 ```c
50 FUNCTION(, void, read_uint16_t, const unsigned char*, source, uint16_t* destination);
51 ```
52
53 `read_uint16_t` reads a uint16_t from `source` and writes it into `destination`.
54
55 **SRS_MEMORY_DATA_02_042: [** `read_uint16_t` shall write in `destination` the bytes at `source` MSB first and return. **]**
56
57 ### read_uint32_t
58 ```c
59 FUNCTION(, void, read_uint32_t, const unsigned char*, source, uint32_t* destination);
60 ```
61
62 `read_uint32_t` reads a uint32_t from `source` and writes it into `destination`.
63
64 **SRS_MEMORY_DATA_02_043: [** `read_uint32_t` shall write in `destination` the bytes at `source` MSB first. **]**
65
66 ### read_uint64_t
67 ```c
68 FUNCTION(, void, read_uint64_t, const unsigned char*, source, uint64_t* destination);
69 ```
70
71 `read_uint64_t` reads a uint64_t from `source` and writes it into `destination`.
72
73 **SRS_MEMORY_DATA_02_044: [** `read_uint64_t` shall write in `destination` the bytes at `source` MSB first. **]**
74
75 ### read_int8_t
76 ```c
77 FUNCTION(, void, read_int8_t, const unsigned char*, source, int8_t* destination);
78 ```
79
80 `read_int8_t` reads a int8_t from `source` and writes it into `destination`.
81
82 **SRS_MEMORY_DATA_02_045: [** `read_int8_t` shall write in `destination` the signed byte at `source`. **]**
83
84 ### read_int16_t
85 ```c
86 FUNCTION(, void, read_int16_t, const unsigned char*, source, int16_t* destination);
87 ```
88
89 `read_int16_t` reads a int16_t from `source` and writes it into `destination`.
90
91 **SRS_MEMORY_DATA_02_046: [** `read_int16_t` shall write in `destination` the bytes at `source` MSB first. **]**
92
93 ### read_int32_t
94 ```c
95 FUNCTION(, void, read_int32_t, const unsigned char*, source, int32_t* destination);
96 ```
97
98 `read_int32_t` reads a int32_t from `source` and writes it into `destination`.
99
100 **SRS_MEMORY_DATA_02_047: [** `read_int32_t` shall write in `destination` the bytes at `source` MSB first. **]**
101
102 ### read_int64_t
103 ```c
104 FUNCTION(, void, read_int64_t, const unsigned char*, source, int64_t* destination);
105 ```
106
107 `read_int64_t` reads a int64_t from `source` and writes it into `destination`.
108
109 **SRS_MEMORY_DATA_02_048: [** `read_int64_t` shall write in `destination` the bytes at `source` MSB first. **]**
110
111 ### read_uuid_t
112
113 ```c
114 FUNCTION(, void, read_uuid_t, unsigned char*, source, UUID_T*, destination);
115 ```
116
117 `read_uuid_t` reads a UUID_T from `source` and writes it into `destination`.
118
119 **SRS_MEMORY_DATA_02_049: [** `read_uuid_t` shall write in `destination` the bytes at `source`. **]**
120
121 ### write_uint8_t
122 ```c
123 FUNCTION(, void, write_uint8_t, unsigned char*, destination, uint8_t value);
124 ```
125
126 `write_uint8_t` writes at `destination` the byte of `value`.
127
128 **SRS_MEMORY_DATA_02_050: [** `write_uint8_t` shall write in `destination` the byte of `value`. **]**
129
130 ### write_uint16_t
131 ```c
132 FUNCTION(, void, write_uint16_t, unsigned char*, destination, uint16_t value);
133 ```
134
135 `write_uint16_t` writes at `destination` the bytes of `value` MSB first.
136
137 **SRS_MEMORY_DATA_02_051: [** `write_uint16_t` shall write in `destination` the bytes of value MSB first. **]**
138
139 ### write_uint32_t
140 ```c
141 FUNCTION(, void, write_uint32_t, unsigned char*, destination, uint32_t value);
142 ```
143
144 `write_uint32_t` writes at `destination` the bytes of `value` MSB first.
145
146 **SRS_MEMORY_DATA_02_052: [** `write_uint32_t` shall write in `destination` the bytes of value MSB first. **]**
147
148 ### write_uint64_t
149 ```c
150 FUNCTION(, void, write_uint64_t, unsigned char*, destination, uint64_t value);
151 ```
152
153 `write_uint64_t` writes at `destination` the bytes of `value` MSB first.
154
155 **SRS_MEMORY_DATA_02_053: [** `write_uint64_t` shall write in `destination` the bytes of value MSB first. **]**
156
157 ### write_int8_t
158 ```c
159 FUNCTION(, void, write_int8_t, unsigned char*, destination, int8_t value);
160 ```
161
162 `write_int8_t` writes a int8_t at `destination`.
163
164 **SRS_MEMORY_DATA_02_054: [** `write_int8_t` shall write at `destination` the byte of `value`. **]**
165
166 ### write_int16_t
167 ```c
168 FUNCTION(, void, write_int16_t, unsigned char*, destination, int16_t value);
169 ```
170
171 `write_int16_t` writes a int16_t at `destination`.
172
173 **SRS_MEMORY_DATA_02_055: [** `write_int16_t` shall write at `destination` the bytes of `value` starting with MSB. **]**
174
175 ### write_int32_t
176 ```c
177 FUNCTION(, void, write_int32_t, unsigned char*, destination, int32_t value);
178 ```
179
180 `write_int32_t` writes a int32_t at `destination`.
181
182 **SRS_MEMORY_DATA_02_056: [** `write_int32_t` shall write at `destination` the bytes of `value` starting with MSB **]**
183
184 ### write_int64_t
185 ```c
186 FUNCTION(, void, write_int64_t, unsigned char*, destination, int64_t value);
187 ```
188
189 `write_int64_t` writes a int64_t at `destination`.
190
191 **SRS_MEMORY_DATA_02_057: [** `write_int64_t` shall write at `destination` the bytes of `value` starting with MSB. **]**
192
193 ### write_uuid_t
194
195 ```c
196 FUNCTION(, void, write_uuid_t, unsigned char*, destination, const UUID_T, value);
197 ```
198
199 `write_uuid_t` writes a UUID_T at `destination`.
200
201 **SRS_MEMORY_DATA_02_058: [** `write_uuid_t` shall write at `destination` the bytes of `value` **]**