(api break) qualify ip_addr_t as const where feasible

this changes the callback signatures of the ip_output and the
{udp,raw}_recv functions.

changes were made by going through all header files, searching for
occurrences of ip_addr_t, qualifying them as const and if required
modifying the corresponding c files, looking for other uses of ip_addr_t
that would be required.

the following header files were not treated as i'm not using them and
wouldn't see them compiled: api.h api_msg.h dhcp.h dns.h igmp.h
netifapi.h pppapi.h snmp.h snmp_msg.h snmp_structs.h ppp.h pppol2tp.h
test/*

no modifications were done on ip6_addr_t.
This commit is contained in:
chrysn
2015-01-24 01:25:18 +01:00
committed by sg
parent df3f05e824
commit 9f065c0ea5
18 changed files with 96 additions and 95 deletions

View File

@@ -108,7 +108,7 @@ static u16_t ip_id;
* @return the netif on which to send to reach dest
*/
struct netif *
ip_route(ip_addr_t *dest)
ip_route(const ip_addr_t *dest)
{
struct netif *netif;
@@ -649,7 +649,7 @@ ip_input(struct pbuf *p, struct netif *inp)
* unique identifiers independent of destination"
*/
err_t
ip_output_if(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
ip_output_if(struct pbuf *p, const ip_addr_t *src, const ip_addr_t *dest,
u8_t ttl, u8_t tos,
u8_t proto, struct netif *netif)
{
@@ -663,12 +663,12 @@ ip_output_if(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
* @ param ip_options pointer to the IP options, copied into the IP header
* @ param optlen length of ip_options
*/
err_t ip_output_if_opt(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
err_t ip_output_if_opt(struct pbuf *p, const ip_addr_t *src, const ip_addr_t *dest,
u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options,
u16_t optlen)
{
#endif /* IP_OPTIONS_SEND */
ip_addr_t *src_used = src;
const ip_addr_t *src_used = src;
if (dest != IP_HDRINCL) {
if (ip_addr_isany(src)) {
src_used = &netif->ip_addr;
@@ -688,7 +688,7 @@ err_t ip_output_if_opt(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
* when it is 'any'.
*/
err_t
ip_output_if_src(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
ip_output_if_src(struct pbuf *p, const ip_addr_t *src, const ip_addr_t *dest,
u8_t ttl, u8_t tos,
u8_t proto, struct netif *netif)
{
@@ -700,7 +700,7 @@ ip_output_if_src(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
* Same as ip_output_if_opt() but 'src' address is not replaced by netif address
* when it is 'any'.
*/
err_t ip_output_if_opt_src(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
err_t ip_output_if_opt_src(struct pbuf *p, const ip_addr_t *src, const ip_addr_t *dest,
u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options,
u16_t optlen)
{
@@ -861,7 +861,7 @@ err_t ip_output_if_opt_src(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
* see ip_output_if() for more return values
*/
err_t
ip_output(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
ip_output(struct pbuf *p, const ip_addr_t *src, const ip_addr_t *dest,
u8_t ttl, u8_t tos, u8_t proto)
{
struct netif *netif;
@@ -898,7 +898,7 @@ ip_output(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
* see ip_output_if() for more return values
*/
err_t
ip_output_hinted(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
ip_output_hinted(struct pbuf *p, const ip_addr_t *src, const ip_addr_t *dest,
u8_t ttl, u8_t tos, u8_t proto, u8_t *addr_hint)
{
struct netif *netif;