00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef MROUTE_SOCKET_HPP
00024 #define MROUTE_SOCKET_HPP
00025
00026 #include "include/utils/mc_socket.hpp"
00027 #include <sys/types.h>
00028
00029 #define MROUTE_RATE_LIMIT_ENDLESS 0
00030 #define MROUTE_TTL_THRESHOLD 1
00031 #define MROUTE_DEFAULT_TTL 1
00032
00033 #define ADD_SIGNED_NUM_U16(r,a) (r)+= (a); (r)+= ((r)>>16)
00034
00038 class mroute_socket: public mc_socket
00039 {
00040 private:
00041 mroute_socket(const mroute_socket ©);
00042
00043
00044
00045 bool create_udp_ipv4_socket(){
00046 return false;
00047 }
00048
00049
00050 bool create_udp_ipv6_socket(){
00051 return false;
00052 }
00053
00054
00055 public:
00056
00060 mroute_socket();
00061
00065 virtual ~mroute_socket();
00066
00071 bool create_raw_ipv4_socket();
00072
00077 bool create_raw_ipv6_socket();
00078
00087 bool set_no_ip_hdr();
00088
00094 u_int16_t calc_checksum(const unsigned char* buf, int buf_size);
00095
00102 bool set_default_icmp6_checksum_calc(bool enable);
00103
00110 bool add_extension_header(const unsigned char* buf, unsigned int buf_size);
00111
00116 bool set_recv_icmpv6_msg();
00117
00122 bool set_recv_hop_by_hop_msg();
00123
00128 bool set_recv_pkt_info();
00129
00135 bool set_mrt_flag(bool enable);
00136
00146 bool add_vif(int vifNum, const char* ifName, const char* ipTunnelRemoteAddr);
00147
00153 bool del_vif(int vifNum);
00154
00166 bool add_mroute(int input_vifNum, const char* source_addr, const char* group_addr, unsigned int* output_vifNum, unsigned int output_vifNum_size);
00167
00175 bool del_mroute(int input_vifNum, const char* source_addr, const char* group_addr);
00176
00180 #define MROUTE_SOCKET_SRC_ADDR_V4 "141.22.27.157"
00181 #define MROUTE_SOCKET_G_ADDR_V4 "238.99.99.99"
00182 #define MROUTE_SOCKET_SRC_ADDR_V6 "fe80::5e26:aff:fe23:8dc1"
00183 #define MROUTE_SOCKET_G_ADDR_V6 "FF02:0:0:0:99:99:99:99"
00184
00185 #define MROUTE_SOCKET_IF_NUM_ONE 0
00186 #define MROUTE_SOCKET_IF_NUM_TWO 1
00187 #define MROUTE_SOCKET_IF_NUM_THREE 2
00188 #define MROUTE_SOCKET_IF_STR_ONE "eth0"
00189 #define MROUTE_SOCKET_IF_STR_TWO "wlan0"
00190 #define MROUTE_SOCKET_IF_STR_THREE "tun0"
00191
00192
00193 static void print_struct_mf6cctl(struct mf6cctl* mc);
00194 static void test_mcrouter_mrt_flag();
00195
00196 static void test_add_vifs(mroute_socket* m);
00197 static void test_del_vifs(mroute_socket* m);
00198 static void test_add_route(mroute_socket* m);
00199 static void test_del_route(mroute_socket* m);
00200 static void test_mcrouter_vifs_routes(int addrFamily);
00201 };
00202
00203 #endif // MROUTE_SOCKET_HPP