renamed mc_sml_set_type_and_length to
sml_buf_set_type_and_length
This commit is contained in:
parent
b1e7570641
commit
35974730bf
14 changed files with 17 additions and 17 deletions
|
@ -82,7 +82,7 @@ void sml_buffer_free(sml_buffer *buf);
|
|||
// the value field.
|
||||
int sml_buf_get_next_length(sml_buffer *buf);
|
||||
|
||||
void mc_sml_set_type_and_length(sml_buffer *buf, unsigned int type, unsigned int l);
|
||||
void sml_buf_set_type_and_length(sml_buffer *buf, unsigned int type, unsigned int l);
|
||||
|
||||
// Checks if a error is occured.
|
||||
int mc_sml_buf_has_errors(sml_buffer *buf);
|
||||
|
|
|
@ -26,7 +26,7 @@ sml_boolean sml_boolean_parse(sml_buffer *buf) {
|
|||
}
|
||||
|
||||
void sml_boolean_write(sml_boolean boolean, sml_buffer *buf) {
|
||||
mc_sml_set_type_and_length(buf, SML_TYPE_BOOLEAN, 1);
|
||||
sml_buf_set_type_and_length(buf, SML_TYPE_BOOLEAN, 1);
|
||||
if (boolean == SML_BOOLEAN_FALSE) {
|
||||
buf->buffer[buf->cursor] = SML_BOOLEAN_FALSE;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ sml_close_request *sml_close_request_init() {
|
|||
}
|
||||
|
||||
void sml_close_request_write(sml_close_request *msg, sml_buffer *buf) {
|
||||
mc_sml_set_type_and_length(buf, SML_TYPE_LIST, 1);
|
||||
sml_buf_set_type_and_length(buf, SML_TYPE_LIST, 1);
|
||||
|
||||
if (msg->global_signature != NULL){
|
||||
sml_octet_string_write(msg->global_signature,buf);
|
||||
|
|
|
@ -28,7 +28,7 @@ sml_get_list_request* sml_get_list_request_init(){
|
|||
}
|
||||
|
||||
void sml_get_list_request_write(sml_get_list_request *msg, sml_buffer *buf) {
|
||||
mc_sml_set_type_and_length(buf, SML_TYPE_LIST, 5);
|
||||
sml_buf_set_type_and_length(buf, SML_TYPE_LIST, 5);
|
||||
|
||||
sml_octet_string_write(msg->client_id, buf);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ sml_get_proc_parameter_request *sml_get_proc_parameter_request_init() {
|
|||
}
|
||||
|
||||
void sml_get_proc_parameter_request_write(sml_get_proc_parameter_request *msg, sml_buffer *buf) {
|
||||
mc_sml_set_type_and_length(buf, SML_TYPE_LIST, 5);
|
||||
sml_buf_set_type_and_length(buf, SML_TYPE_LIST, 5);
|
||||
|
||||
// optional server_id
|
||||
if (msg->server_id != NULL){
|
||||
|
|
|
@ -33,7 +33,7 @@ sml_get_profile_pack_request *sml_get_profile_pack_request_init(){
|
|||
}
|
||||
|
||||
void sml_get_profile_pack_request_write(sml_get_profile_pack_request *msg, sml_buffer *buf) {
|
||||
mc_sml_set_type_and_length(buf, SML_TYPE_LIST, 9);
|
||||
sml_buf_set_type_and_length(buf, SML_TYPE_LIST, 9);
|
||||
|
||||
// server_id
|
||||
if (msg->server_id != NULL) {
|
||||
|
|
|
@ -100,7 +100,7 @@ error:
|
|||
}
|
||||
|
||||
void sml_list_write(sml_list *list, sml_buffer *buf){
|
||||
mc_sml_set_type_and_length(buf, SML_TYPE_LIST, 1);
|
||||
sml_buf_set_type_and_length(buf, SML_TYPE_LIST, 1);
|
||||
mc_sml_optional_write(buf);
|
||||
//
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ void sml_message_free(sml_message *msg) {
|
|||
|
||||
void sml_message_write(sml_message *msg, sml_buffer *buf) {
|
||||
int msg_start = buf->cursor;
|
||||
mc_sml_set_type_and_length(buf, SML_TYPE_LIST, 6);
|
||||
sml_buf_set_type_and_length(buf, SML_TYPE_LIST, 6);
|
||||
sml_octet_string_write(msg->transaction_id, buf);
|
||||
sml_number_write(SML_TYPE_UNSIGNED, SML_TYPE_NUMBER_8, (u64) msg->group_id, buf);
|
||||
sml_number_write(SML_TYPE_UNSIGNED, SML_TYPE_NUMBER_8, (u64) msg->abort_on_error, buf);
|
||||
|
@ -176,7 +176,7 @@ sml_message_body *sml_message_body_init(u16 tag, void *data) {
|
|||
}
|
||||
|
||||
void sml_message_body_write(sml_message_body *message_body, sml_buffer *buf) {
|
||||
mc_sml_set_type_and_length(buf, SML_TYPE_LIST, 2);
|
||||
sml_buf_set_type_and_length(buf, SML_TYPE_LIST, 2);
|
||||
sml_number_write(SML_TYPE_UNSIGNED, SML_TYPE_NUMBER_16, (u64) message_body->tag, buf);
|
||||
|
||||
switch (message_body->tag) {
|
||||
|
|
|
@ -48,7 +48,7 @@ u64 mc_sml_parse_number(sml_buffer *buf, unsigned char type, int max_size) {
|
|||
}
|
||||
|
||||
void sml_number_write(unsigned char type, int size, u64 value, sml_buffer *buf) {
|
||||
mc_sml_set_type_and_length(buf, type, size);
|
||||
sml_buf_set_type_and_length(buf, type, size);
|
||||
int i;
|
||||
u64 mask = 0xFF;
|
||||
mask <<= (8 * (size - 1));
|
||||
|
|
|
@ -99,7 +99,7 @@ octet_string *sml_octet_string_parse(sml_buffer *buf) {
|
|||
}
|
||||
|
||||
void sml_octet_string_write(octet_string *str, sml_buffer *buf) {
|
||||
mc_sml_set_type_and_length(buf, SML_TYPE_OCTET_STRING, (unsigned int) str->len);
|
||||
sml_buf_set_type_and_length(buf, SML_TYPE_OCTET_STRING, (unsigned int) str->len);
|
||||
memcpy(mc_sml_buf_get_current_buf(buf), str->str, str->len);
|
||||
buf->cursor += str->len;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ sml_open_request *sml_open_request_init() {
|
|||
}
|
||||
*/
|
||||
void sml_open_request_write(sml_open_request *msg, sml_buffer *buf) {
|
||||
mc_sml_set_type_and_length(buf, SML_TYPE_LIST, 7);
|
||||
sml_buf_set_type_and_length(buf, SML_TYPE_LIST, 7);
|
||||
|
||||
mc_sml_optional_write(buf);
|
||||
sml_octet_string_write(msg->client_id, buf);
|
||||
|
|
|
@ -28,7 +28,7 @@ sml_set_proc_parameter_request *sml_set_proc_parameter_request_init() {
|
|||
}
|
||||
|
||||
void sml_set_proc_parameter_request_write(sml_set_proc_parameter_request *msg, sml_buffer *buf) {
|
||||
mc_sml_set_type_and_length(buf, SML_TYPE_LIST, 5);
|
||||
sml_buf_set_type_and_length(buf, SML_TYPE_LIST, 5);
|
||||
mc_sml_optional_write(buf);
|
||||
mc_sml_optional_write(buf);
|
||||
mc_sml_optional_write(buf);
|
||||
|
|
|
@ -43,7 +43,7 @@ int sml_buf_get_next_length(sml_buffer *buf) {
|
|||
return length + list;
|
||||
}
|
||||
|
||||
void mc_sml_set_type_and_length(sml_buffer *buf, unsigned int type, unsigned int l) {
|
||||
void sml_buf_set_type_and_length(sml_buffer *buf, unsigned int type, unsigned int l) {
|
||||
// set the type
|
||||
buf->buffer[buf->cursor] |= type;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ void sml_tree_path_add_path_entry(sml_tree_path *tree_path, octet_string *entry)
|
|||
void sml_tree_path_write(sml_tree_path *tree_path, sml_buffer *buf) {
|
||||
int i;
|
||||
if (tree_path->path_entries && tree_path->path_entries_len > 0) {
|
||||
mc_sml_set_type_and_length(buf, SML_TYPE_LIST, tree_path->path_entries_len);
|
||||
sml_buf_set_type_and_length(buf, SML_TYPE_LIST, tree_path->path_entries_len);
|
||||
for (i = 0; i < tree_path->path_entries_len; i++) {
|
||||
sml_octet_string_write(tree_path->path_entries[i], buf);
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ void sml_tree_free(sml_tree *tree){
|
|||
}
|
||||
|
||||
void sml_tree_write(sml_tree *tree, sml_buffer *buf) {
|
||||
mc_sml_set_type_and_length(buf, SML_TYPE_LIST, 3);
|
||||
sml_buf_set_type_and_length(buf, SML_TYPE_LIST, 3);
|
||||
sml_octet_string_write(tree->parameter_name, buf);
|
||||
// TODO
|
||||
sml_proc_par_value_write(tree->parameter_value, buf);
|
||||
|
@ -103,7 +103,7 @@ sml_proc_par_value *sml_proc_par_value_init(u8 tag, void *data) {
|
|||
}
|
||||
|
||||
void sml_proc_par_value_write(sml_proc_par_value *value, sml_buffer *buf) {
|
||||
mc_sml_set_type_and_length(buf, SML_TYPE_LIST, 2);
|
||||
sml_buf_set_type_and_length(buf, SML_TYPE_LIST, 2);
|
||||
sml_number_write(SML_TYPE_UNSIGNED, SML_TYPE_NUMBER_8, (u64) value->tag, buf);
|
||||
|
||||
switch (value->tag) {
|
||||
|
|
Loading…
Add table
Reference in a new issue