]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/other/rscript/send_functor.h
Merge pull request #2 from bobr-kun/MySQL_custom_port
[stg.git] / projects / stargazer / plugins / other / rscript / send_functor.h
index 8e216295ae36fea22cb2e8d1f473752ebb82f2a1..ea3efda1b5dab65a06ca637bd1b63b50961d0574 100644 (file)
@@ -15,7 +15,7 @@
  */
 
 /*
  */
 
 /*
- *    Author : Maxim Mamontov <faust@stargazer.dp.ua>
+ *    Author : Maksym Mamontov <stg@madf.info>
  */
 
 /*
  */
 
 /*
 #ifndef __SEND_FUNCTOR_H__
 #define __SEND_FUNCTOR_H__
 
 #ifndef __SEND_FUNCTOR_H__
 #define __SEND_FUNCTOR_H__
 
-#include <sys/types.h>
-#include <sys/socket.h>
+#include "stg/os_int.h"
 
 #include <functional>
 
 
 #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:
     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),
             : 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;
 
         {
         struct sockaddr_in sendAddr;
 
@@ -54,7 +56,7 @@ class PacketSender : public std::unary_function<uint32_t, int> {
     private:
         int sock;
         char * buffer;
     private:
         int sock;
         char * buffer;
-        int length;
+        size_t length;
         uint16_t port;
 };
 
         uint16_t port;
 };