wangzhengquan
2020-10-12 d26e81c4213dfb04391c7b6692f243aede2e6895
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef __NET_MODE_SOCKET_H__
#define __NET_MODE_SOCKET_H__
#include "usg_common.h"
#include "shm_mod_socket.h"
#include "socket_io.h"
 
struct net_node_t
{
    const char *host;
    int port;
    int key;
};
 
 
struct net_mod_request_head_t {
    socket_mod_t mod;
    int key;
    uint32_t content_length;
};
 
struct net_mod_response_head_t {
    // socket_mod_t mod;
    // int key;
    uint32_t content_length;
};
 
 
struct net_mod_recv_msg_t
{
  char host[128];
  int port;
  int key;
  void *content;
  uint32_t content_length;
  
};
 
class NetModSocket {
 
private:
   static std::map<std::string, rio_t *> connectionMap;
   ShmModSocket shmModSocket;
public:
    
  NetModSocket();
  int sendandrecv(net_node_t *node_arr, int arrlen, void *send_buf, int send_size, 
      net_mod_recv_msg_t ** resp_arr, int *resp_arr_size);
 
  ~NetModSocket();
 
   static void  free_recv_msg_arr(net_mod_recv_msg_t * arr, size_t size);
};
 
 
 
#endif