Skip to content
This repository was archived by the owner on Dec 26, 2022. It is now read-only.

Commit 4ed2bc8

Browse files
committed
fix: Rename ta_send_mam obj for consistency
Other TA object all have `ta` prefix, so `send_mam` objects are renamed to `ta_send_mam` object.
1 parent 7e91526 commit 4ed2bc8

File tree

9 files changed

+42
-42
lines changed

9 files changed

+42
-42
lines changed

accelerator/apis.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ status_t api_mam_send_message(const iota_config_t* const tangle,
221221
bundle_transactions_new(&bundle);
222222
tryte_t channel_id[MAM_CHANNEL_ID_SIZE];
223223
trit_t msg_id[MAM_MSG_ID_SIZE];
224-
send_mam_req_t* req = send_mam_req_new();
225-
send_mam_res_t* res = send_mam_res_new();
224+
ta_send_mam_req_t* req = send_mam_req_new();
225+
ta_send_mam_res_t* res = send_mam_res_new();
226226

227227
// Loading and creating MAM API
228228
if ((rc = mam_api_load(tangle->mam_file, &mam)) ==

request/ta_send_mam.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#include "ta_send_mam.h"
22

3-
send_mam_req_t* send_mam_req_new() {
4-
send_mam_req_t* req = (send_mam_req_t*)malloc(sizeof(send_mam_req_t));
3+
ta_send_mam_req_t* send_mam_req_new() {
4+
ta_send_mam_req_t* req = (ta_send_mam_req_t*)malloc(sizeof(ta_send_mam_req_t));
55
if (req) {
66
req->payload_trytes = NULL;
77
}
88

99
return req;
1010
}
1111

12-
status_t send_mam_req_set_payload(send_mam_req_t* req, const tryte_t* payload) {
12+
status_t send_mam_req_set_payload(ta_send_mam_req_t* req, const tryte_t* payload) {
1313
status_t ret = SC_OK;
1414
size_t payload_size = sizeof(payload) / sizeof(tryte_t);
1515

@@ -27,7 +27,7 @@ status_t send_mam_req_set_payload(send_mam_req_t* req, const tryte_t* payload) {
2727
return ret;
2828
}
2929

30-
void send_mam_req_free(send_mam_req_t** req) {
30+
void send_mam_req_free(ta_send_mam_req_t** req) {
3131
if (!req || !(*req)) {
3232
return;
3333
}

request/ta_send_mam.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ extern "C" {
1111
typedef struct send_mam_req_s {
1212
tryte_t* payload_trytes;
1313
size_t payload_trytes_size;
14-
} send_mam_req_t;
14+
} ta_send_mam_req_t;
1515

16-
send_mam_req_t* send_mam_req_new();
17-
status_t send_mam_req_set_payload(send_mam_req_t* req, const tryte_t* payload);
18-
void send_mam_req_free(send_mam_req_t** req);
16+
ta_send_mam_req_t* send_mam_req_new();
17+
status_t send_mam_req_set_payload(ta_send_mam_req_t* req, const tryte_t* payload);
18+
void send_mam_req_free(ta_send_mam_req_t** req);
1919

2020
#ifdef __cplusplus
2121
}

response/ta_send_mam.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#include "ta_send_mam.h"
22

3-
send_mam_res_t* send_mam_res_new() {
4-
send_mam_res_t* res = (send_mam_res_t*)malloc(sizeof(send_mam_res_t));
3+
ta_send_mam_res_t* send_mam_res_new() {
4+
ta_send_mam_res_t* res = (ta_send_mam_res_t*)malloc(sizeof(ta_send_mam_res_t));
55

66
return res;
77
}
88

9-
status_t send_mam_res_set_bundle_hash(send_mam_res_t* res,
9+
status_t send_mam_res_set_bundle_hash(ta_send_mam_res_t* res,
1010
const tryte_t* bundle_hash) {
1111
if (!bundle_hash || !res) {
1212
return SC_RES_NULL;
@@ -17,7 +17,7 @@ status_t send_mam_res_set_bundle_hash(send_mam_res_t* res,
1717
return SC_OK;
1818
}
1919

20-
status_t send_mam_res_set_channel_id(send_mam_res_t* res,
20+
status_t send_mam_res_set_channel_id(ta_send_mam_res_t* res,
2121
const tryte_t* channel_id) {
2222
if (!channel_id || !res) {
2323
return SC_RES_NULL;
@@ -28,7 +28,7 @@ status_t send_mam_res_set_channel_id(send_mam_res_t* res,
2828
return SC_OK;
2929
}
3030

31-
void send_mam_res_free(send_mam_res_t** res) {
31+
void send_mam_res_free(ta_send_mam_res_t** res) {
3232
if (!res || !(*res)) {
3333
return;
3434
}

response/ta_send_mam.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ typedef struct send_mam_res_s {
1818
char bundle_hash[NUM_TRYTES_HASH + 1];
1919
/** ascii string channel id */
2020
char channel_id[NUM_TRYTES_HASH + 1];
21-
} send_mam_res_t;
21+
} ta_send_mam_res_t;
2222

2323
/**
24-
* Allocate memory of send_mam_res_t
24+
* Allocate memory of ta_send_mam_res_t
2525
*
2626
* @return
27-
* - struct of send_mam_res_t on success
27+
* - struct of ta_send_mam_res_t on success
2828
* - NULL on error
2929
*/
30-
send_mam_res_t* send_mam_res_new();
30+
ta_send_mam_res_t* send_mam_res_new();
3131

3232
/**
3333
* @brief Set the bundle_hash field of send_mam_res object.
@@ -36,14 +36,14 @@ send_mam_res_t* send_mam_res_new();
3636
* and convert (instead of decoding) the received bundle hash to ascii string.
3737
* After conversion, set the bundle_hash field of send_mam_res object.
3838
*
39-
* @param[in] res send_mam_res_t struct object
39+
* @param[in] res ta_send_mam_res_t struct object
4040
* @param[in] bundle_hash bundle hash decoded in trytes string
4141
*
4242
* @return
4343
* - SC_OK on success
4444
* - non-zero on error
4545
*/
46-
status_t send_mam_res_set_bundle_hash(send_mam_res_t* res,
46+
status_t send_mam_res_set_bundle_hash(ta_send_mam_res_t* res,
4747
const tryte_t* bundle_hash);
4848

4949
/**
@@ -53,24 +53,24 @@ status_t send_mam_res_set_bundle_hash(send_mam_res_t* res,
5353
* and convert (instead of decoding) the received channel id to ascii string.
5454
* After conversion, set the channel_id field of send_mam_res object.
5555
*
56-
* @param[in] res send_mam_res_t struct object
56+
* @param[in] res ta_send_mam_res_t struct object
5757
* @param[in] channel_id channel id decoded in trytes string
5858
*
5959
* @return
6060
* - SC_OK on success
6161
* - non-zero on error
6262
*/
63-
status_t send_mam_res_set_channel_id(send_mam_res_t* res,
63+
status_t send_mam_res_set_channel_id(ta_send_mam_res_t* res,
6464
const tryte_t* channel_id);
6565

6666
/**
67-
* Free memory of send_mam_res_t
67+
* Free memory of ta_send_mam_res_t
6868
*
69-
* @param req Data type of send_mam_res_t
69+
* @param req Data type of ta_send_mam_res_t
7070
*
7171
* @return NULL
7272
*/
73-
void send_mam_res_free(send_mam_res_t** res);
73+
void send_mam_res_free(ta_send_mam_res_t** res);
7474

7575
#ifdef __cplusplus
7676
}

serializer/serializer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ status_t receive_mam_message_serialize(char** obj, char** const res) {
556556
return ret;
557557
}
558558

559-
status_t send_mam_res_serialize(char** obj, const send_mam_res_t* const res) {
559+
status_t send_mam_res_serialize(char** obj, const ta_send_mam_res_t* const res) {
560560
status_t ret = SC_OK;
561561
cJSON* json_root = cJSON_CreateObject();
562562
if (json_root == NULL) {
@@ -580,7 +580,7 @@ status_t send_mam_res_serialize(char** obj, const send_mam_res_t* const res) {
580580
}
581581

582582
status_t send_mam_res_deserialize(const char* const obj,
583-
send_mam_res_t* const res) {
583+
ta_send_mam_res_t* const res) {
584584
if (obj == NULL) {
585585
return SC_SERIALIZER_NULL;
586586
}
@@ -610,7 +610,7 @@ status_t send_mam_res_deserialize(const char* const obj,
610610
return ret;
611611
}
612612

613-
status_t send_mam_req_deserialize(const char* const obj, send_mam_req_t* req) {
613+
status_t send_mam_req_deserialize(const char* const obj, ta_send_mam_req_t* req) {
614614
if (obj == NULL) {
615615
return SC_SERIALIZER_NULL;
616616
}

serializer/serializer.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,41 +153,41 @@ status_t ta_find_transactions_obj_res_serialize(
153153
status_t receive_mam_message_serialize(char** obj, char** const res);
154154

155155
/**
156-
* @brief Serialze type of send_mam_res_t to JSON string
156+
* @brief Serialze type of ta_send_mam_res_t to JSON string
157157
*
158158
* @param[out] obj send mam response object in JSON
159-
* @param[in] res Response data in type of send_mam_res_t
159+
* @param[in] res Response data in type of ta_send_mam_res_t
160160
*
161161
* @return
162162
* - SC_OK on success
163163
* - non-zero on error
164164
*/
165-
status_t send_mam_res_serialize(char** obj, const send_mam_res_t* const res);
165+
status_t send_mam_res_serialize(char** obj, const ta_send_mam_res_t* const res);
166166

167167
/**
168-
* @brief Deserialze JSON string to type of send_mam_res_t
168+
* @brief Deserialze JSON string to type of ta_send_mam_res_t
169169
*
170170
* @param[in] obj Input values in JSON
171-
* @param[out] res Response data in type of send_mam_res_t
171+
* @param[out] res Response data in type of ta_send_mam_res_t
172172
*
173173
* @return
174174
* - SC_OK on success
175175
* - non-zero on error
176176
*/
177177
status_t send_mam_res_deserialize(const char* const obj,
178-
send_mam_res_t* const res);
178+
ta_send_mam_res_t* const res);
179179

180180
/**
181-
* @brief Deserialze JSON string to type of send_mam_req_t
181+
* @brief Deserialze JSON string to type of ta_send_mam_req_t
182182
*
183183
* @param[in] obj Input values in JSON
184-
* @param[out] req Request data in type of send_mam_req_t
184+
* @param[out] req Request data in type of ta_send_mam_req_t
185185
*
186186
* @return
187187
* - SC_OK on success
188188
* - non-zero on error
189189
*/
190-
status_t send_mam_req_deserialize(const char* const obj, send_mam_req_t* req);
190+
status_t send_mam_req_deserialize(const char* const obj, ta_send_mam_req_t* req);
191191
#ifdef __cplusplus
192192
}
193193
#endif

tests/driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ static ta_core_t ta_core;
66
struct timespec start_time, end_time;
77

88
char driver_tag_msg[NUM_TRYTES_TAG];
9-
send_mam_res_t* res;
9+
ta_send_mam_res_t* res;
1010

1111
#if defined(ENABLE_STAT)
1212
#define TEST_COUNT 100

tests/test_serializer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ void test_serialize_send_mam_message(void) {
258258
"\","
259259
"\"bundle_hash\":\"" TRYTES_81_2 "\"}";
260260
char* json_result;
261-
send_mam_res_t* res = send_mam_res_new();
261+
ta_send_mam_res_t* res = send_mam_res_new();
262262

263263
send_mam_res_set_bundle_hash(res, (tryte_t*)TRYTES_81_2);
264264
send_mam_res_set_channel_id(res, (tryte_t*)TRYTES_81_1);
@@ -274,7 +274,7 @@ void test_deserialize_send_mam_message_response(void) {
274274
const char* json = "{\"channel\":\"" TRYTES_81_1
275275
"\","
276276
"\"bundle_hash\":\"" TRYTES_81_2 "\"}";
277-
send_mam_res_t* res = send_mam_res_new();
277+
ta_send_mam_res_t* res = send_mam_res_new();
278278

279279
send_mam_res_deserialize(json, res);
280280

@@ -286,7 +286,7 @@ void test_deserialize_send_mam_message_response(void) {
286286

287287
void test_deserialize_send_mam_message(void) {
288288
const char* json = "{\"message\":\"" TEST_PAYLOAD "\"}";
289-
send_mam_req_t* req = send_mam_req_new();
289+
ta_send_mam_req_t* req = send_mam_req_new();
290290

291291
send_mam_req_deserialize(json, req);
292292

0 commit comments

Comments
 (0)