X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/4d9199a0203c54711e764c835bae5945417257e5..28e7683d83570df1fc6b44a74e8eb0782b8bd9a2:/projects/stargazer/plugins/other/rscript/send_functor.h?ds=sidebyside diff --git a/projects/stargazer/plugins/other/rscript/send_functor.h b/projects/stargazer/plugins/other/rscript/send_functor.h index 8e216295..dc8ad63a 100644 --- a/projects/stargazer/plugins/other/rscript/send_functor.h +++ b/projects/stargazer/plugins/other/rscript/send_functor.h @@ -27,21 +27,23 @@ #ifndef __SEND_FUNCTOR_H__ #define __SEND_FUNCTOR_H__ -#include <sys/types.h> -#include <sys/socket.h> +#include "stg/os_int.h" #include <functional> -#include "os_int.h" +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <netinet/ip.h> -class PacketSender : public std::unary_function<uint32_t, int> { +class PacketSender : public std::unary_function<uint32_t, ssize_t> { public: - PacketSender(int s, char * b, int l, uint16_t p) + PacketSender(int s, char * b, size_t l, uint16_t p) : sock(s), buffer(b), length(l), - port(p) {}; - int operator() (uint32_t ip) + port(p) {} + ssize_t operator() (uint32_t ip) { struct sockaddr_in sendAddr; @@ -54,7 +56,7 @@ class PacketSender : public std::unary_function<uint32_t, int> { private: int sock; char * buffer; - int length; + size_t length; uint16_t port; };