2016-03-12 23:29:25 +01:00
|
|
|
#include <errno.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
|
|
|
|
#include "log.h"
|
|
|
|
#include "dbg.h"
|
|
|
|
#include "cw.h"
|
|
|
|
|
2018-04-07 19:28:00 +02:00
|
|
|
int cw_put_local_ip_address(uint8_t *dst, int id, int ipv4_id, int ipv6_id,
|
|
|
|
uint8_t *src, int len)
|
2016-03-12 23:29:25 +01:00
|
|
|
{
|
|
|
|
|
2018-04-07 19:28:00 +02:00
|
|
|
if (len ==4 && id == ipv4_id){
|
|
|
|
cw_put_data(dst + 4, src, 4);
|
|
|
|
return 4 + cw_put_elem_hdr(dst, id, 4);
|
2016-03-12 23:29:25 +01:00
|
|
|
}
|
|
|
|
|
2018-04-07 19:28:00 +02:00
|
|
|
if (len ==16 && id == ipv6_id){
|
|
|
|
|
|
|
|
cw_put_data(dst + 4, src, 16);
|
|
|
|
return 4 + cw_put_elem_hdr(dst, id, 4);
|
|
|
|
}
|
2016-03-12 23:29:25 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-04-07 19:28:00 +02:00
|
|
|
|
|
|
|
|