Repository : ssh://git@open-mesh.org/alfred
On branch : master
commit 5509c3bb8b7658e604cf8b84cb9e753fe4ef07bc Author: Sven Eckelmann sven@open-mesh.com Date: Fri Jan 11 13:30:29 2013 +0100
alfred: Move send_alfred_packet to send.c
send_alfred_packet is a send-only function. The better home for this function would be send.c instead of recv.c because recv.c has more a focus on processing incoming packets.
Signed-off-by: Sven Eckelmann sven@open-mesh.com
5509c3bb8b7658e604cf8b84cb9e753fe4ef07bc recv.c | 19 ------------------- send.c | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/recv.c b/recv.c index 82ab1ff..37bcc3d 100644 --- a/recv.c +++ b/recv.c @@ -233,22 +233,3 @@ int recv_alfred_packet(struct globals *globals)
return 0; } - -int send_alfred_packet(struct globals *globals, const struct in6_addr *dest, - void *buf, int length) -{ - int ret; - struct sockaddr_in6 dest_addr; - - memset(&dest_addr, 0, sizeof(dest_addr)); - dest_addr.sin6_family = AF_INET6; - dest_addr.sin6_port = htons(ALFRED_PORT); - dest_addr.sin6_scope_id = globals->scope_id; - memcpy(&dest_addr.sin6_addr, dest, sizeof(*dest)); - - ret = sendto(globals->netsock, buf, length, 0, - (struct sockaddr *)&dest_addr, - sizeof(struct sockaddr_in6)); - - return (ret == length); -} diff --git a/send.c b/send.c index 261185b..8b52ed1 100644 --- a/send.c +++ b/send.c @@ -123,3 +123,22 @@ int push_local_data(struct globals *globals)
return 0; } + +int send_alfred_packet(struct globals *globals, const struct in6_addr *dest, + void *buf, int length) +{ + int ret; + struct sockaddr_in6 dest_addr; + + memset(&dest_addr, 0, sizeof(dest_addr)); + dest_addr.sin6_family = AF_INET6; + dest_addr.sin6_port = htons(ALFRED_PORT); + dest_addr.sin6_scope_id = globals->scope_id; + memcpy(&dest_addr.sin6_addr, dest, sizeof(*dest)); + + ret = sendto(globals->netsock, buf, length, 0, + (struct sockaddr *)&dest_addr, + sizeof(struct sockaddr_in6)); + + return (ret == length); +}