y_socket: add header(json_t) & content list, send and receive functions
This commit is contained in:
@@ -1,7 +1,17 @@
|
||||
/*file: include/y_socket_t/y_file_handler.h */
|
||||
#ifndef Y_FILE_HANDLER_T_H__C
|
||||
#define Y_FILE_HANDLER_T_H__C
|
||||
|
||||
#include "y_socket_t/y_socket_t.h"
|
||||
#include "y_socket_t/y_node_t.h"
|
||||
#include "y_socket_t/y_list_string.h"
|
||||
|
||||
#include "y_worker_t/y_worker_t.h"
|
||||
#include "y_worker_t/y_task_t.h"
|
||||
|
||||
#include "json_t/json_t.h"
|
||||
|
||||
|
||||
|
||||
void fileNameDateScore(char* filename, char * pre, char* post,size_t score);
|
||||
|
||||
@@ -12,7 +22,51 @@ struct arg_send_file{
|
||||
};
|
||||
|
||||
void* y_socket_send_file_for_all_nodes(void* arg);
|
||||
void receve_from_node(struct pollfd *fds, char *msg, size_t count);
|
||||
|
||||
enum cmd_type {
|
||||
cmd_update_kill,
|
||||
cmd_update_standby,
|
||||
cmd_update_wakeup,
|
||||
cmd_post_file,
|
||||
cmd_post_var,
|
||||
cmd_get_file,
|
||||
cmd_get_var,
|
||||
};
|
||||
|
||||
|
||||
typedef struct msg_content_t {
|
||||
enum cmd_type cmd_t;
|
||||
size_t seq;
|
||||
char eof;
|
||||
size_t size_content;
|
||||
char *content;
|
||||
size_t size_nameid;
|
||||
char * nameid;/* containerid: filename_src_dst_tm */
|
||||
} y_MSG_CONTENT_T;
|
||||
|
||||
typedef struct msg_content_t * y_ptr_MSG_CONTENT_T;
|
||||
GENERATE_LIST_ALL(y_ptr_MSG_CONTENT_T)
|
||||
GEN_HEAD_PTR_LIST(y_ptr_MSG_CONTENT_T)
|
||||
|
||||
|
||||
typedef struct header_t {
|
||||
enum cmd_type cmd_t;
|
||||
// size_t seq;
|
||||
char eof;
|
||||
// void *content;
|
||||
size_t size_nameid;
|
||||
char * nameid;/* containerid: filename_src_dst_tm */
|
||||
struct main_list_y_ptr_MSG_CONTENT_T * m_content_l;
|
||||
} y_HEADER_T;
|
||||
|
||||
typedef struct header_t * y_ptr_HEADER_T;
|
||||
|
||||
GENERATE_LIST_ALL(y_ptr_HEADER_T)
|
||||
GEN_HEAD_PTR_LIST(y_ptr_HEADER_T)
|
||||
|
||||
|
||||
size_t set_tempAddr_from_node(char *tempAddr, y_NODE_T node);
|
||||
//void receve_from_node(struct pollfd *fds, char *msg, size_t count);
|
||||
void receve_from_node(struct main_list_y_ptr_HEADER_T *m_head_l_t, struct main_list_y_ptr_STRING *m_str, char * srcAddr, char *filename);
|
||||
|
||||
#endif /*Y_FILE_HANDLER_T_H__C*/
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
//#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
@@ -46,6 +48,7 @@ enum ipVersions{
|
||||
extern const int af_array[nbIpVersion];//={AF_INET, AF_INET6};
|
||||
|
||||
/* y_ptr_STRING */
|
||||
|
||||
#if 0
|
||||
struct y_string{
|
||||
char * buf;
|
||||
@@ -68,7 +71,7 @@ struct y_socket_t{
|
||||
size_t size_fds;
|
||||
char * port;
|
||||
struct main_list_y_NODE_T *nodes;
|
||||
pthread_mutex_t *mut_nodes;
|
||||
// pthread_mutex_t *mut_nodes;
|
||||
int go_on;
|
||||
pthread_mutex_t *mut_go_on;
|
||||
int nb_workers;
|
||||
|
||||
Reference in New Issue
Block a user