Main Page   Modules   Data Structures   File List   Globals  

msg.h

Go to the documentation of this file.
00001 #if !defined(_MSG_H_)
00002 #define _MSG_H_
00003 
00013 #include <apr_uuid.h>
00014 #include "sumalib.h"
00015 #include "internal.h"
00016 #if defined(XML_SETTINGS)
00017 #include "settings.h"
00018 #endif  /* XML_SETTINGS */
00019 
00020 #define P2P_KIND_HELLO1         "HELLO1"
00021 #define P2P_KIND_REPLY1         "REPLY1"
00022 #define P2P_KIND_HELLO2         "HELLO2"
00023 #define P2P_KIND_REPLY2         "REPLY2"
00024 #define P2P_KIND_BROAD          "BROAD"
00025 #define P2P_KIND_MULTI          "MULTI"
00026 #define P2P_KIND_UNI            "UNI"
00027 
00028 #define LENGTH_SIZE     (sizeof(unsigned int))
00029 
00032 typedef struct {
00033   unsigned int length;
00034   char kind[8];
00035   char src_uuid[APR_UUID_FORMATTED_LENGTH + 1];
00036 } p2p_msg_common_t;
00037 
00038 typedef struct {
00039   p2p_msg_common_t common;
00040   char ipaddr[16];
00041   unsigned long port;
00042   unsigned long r;      /* resolution */
00043   char ep_uuid[APR_UUID_FORMATTED_LENGTH + 1];
00044 #if !defined(PROHIBIT_LOCAL_CONNECTION)
00045   int is_local;
00046   char your_ipaddr[16];
00047 #endif  /* !PROHIBIT_LOCAL_CONNECTION */
00048 } p2p_msg_hello_t;
00049 
00050 typedef struct {
00051   char ipaddr[16];
00052   unsigned long port;
00053   int is_tunnel;
00054   char uuid[APR_UUID_FORMATTED_LENGTH + 1];
00055 } p2p_cmem_t;
00056 
00057 typedef struct {
00058   p2p_msg_common_t common;
00059   unsigned long r;      /* resolution */
00060   char newbee_uuid[APR_UUID_FORMATTED_LENGTH + 1];
00061   unsigned int n_mem;
00062   p2p_cmem_t mem[0];
00063 } p2p_msg_reply_t;
00064 
00065 typedef struct {
00066   p2p_msg_common_t common;
00067   unsigned int port;
00068 } p2p_msg_broadcast_header_t;
00069 
00070 typedef struct {
00071   p2p_msg_common_t common;
00072   unsigned int port;
00073   unsigned int n_dst;
00074   char dst_uuids[0][APR_UUID_FORMATTED_LENGTH + 1];
00075 } p2p_msg_multicast_header_t;
00076 
00077 typedef struct {        /* this is used as a reply */
00078   p2p_msg_common_t common;
00079   unsigned int port;
00080   char dst_uuid[APR_UUID_FORMATTED_LENGTH + 1];
00081   unsigned int length;
00082 } p2p_msg_unicast_header_t;
00083 
00087 int process_reply1(p2p_connection_t *conn, char *buf);
00088 int reply1_cb(p2p_channel_t *chann);
00089 int process_hello1(p2p_connection_t *tmp, char *buf);
00090 int process_hello2(p2p_connection_t *conn, char *buf);
00091 int process_broad(p2p_connection_t *conn, char *buf);
00092 int process_multi(p2p_connection_t *conn, char *buf);
00093 int process_uni(p2p_connection_t *conn, char *buf);
00094 char *construct_msg(p2p_channel_t *chann, char *body, int len);
00095 void establish_basic_connection(
00096 #if defined(XML_SETTINGS)
00097                                 str_elem_link_t *entry_points
00098 #else
00099                                 char *entry_points_ip_addrs[]
00100 #endif
00101                                 );
00102 p2p_destinations_t *construct_destinations_from_msg(char *buf);
00103 void exec_callback_if_possible(char *buf, p2p_destinations_t *dst);
00104 int relay_local(char *msg);
00105 
00108 #endif  /* _MSG_H_ */

Generated on Wed Aug 28 14:45:08 2002 for suma by doxygen1.2.17