-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update ipv6 trace helper functions. In a recent update to libService the ip6tos function was slightly updated and ip6_prefix_tos was added. Update mbed-trace to make use of the updated functions, simplifying code and getting rid of some temporary variables. * Updated unittests. Added libservice as a dependency for bitcopy and removed its stub. It should be as reliable as std library functions so no need for stubbing. Added a stub for ip6_prefix_tos function. Made the ip6tos stub control structures clearer. Added tests for trace_ipv6_prefix error cases. The previous formatting tests now make little sense as no actual formatting is done by trace_ipv6_prefix.
- Loading branch information
Showing
8 changed files
with
65 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
/* | ||
* Copyright (c) 2016 ARM Limited. All rights reserved. | ||
*/ | ||
#include "ip6string_stub.h" | ||
#include "ip6string.h" | ||
#include <string.h> | ||
#include <stdio.h> | ||
#include "common_functions.h" | ||
|
||
const char *ip6tos_output_string; | ||
extern uint8_t ip6tos_input_array[16]; | ||
#include "ip6tos_stub.h" | ||
|
||
void ip6tos(const void *ip6addr, char *p) | ||
ip6tos_stub_def_t ip6tos_stub; // extern variable | ||
|
||
uint8_t ip6tos(const void *ip6addr, char *p) | ||
{ | ||
memcpy(ip6tos_stub.input_array, ip6addr, 16); | ||
strcpy(p, ip6tos_stub.output_string); | ||
return strlen(p); | ||
} | ||
|
||
uint_fast8_t ip6_prefix_tos(const void *prefix, uint_fast8_t prefix_len, char *p) | ||
{ | ||
memcpy(ip6tos_input_array, ip6addr, 16); | ||
strcpy(p, ip6tos_output_string); | ||
bitcopy(ip6tos_stub.input_array, prefix, prefix_len); | ||
strcpy(p, ip6tos_stub.output_string); | ||
return strlen(p); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters