static struct v3_packet_hooks * packet_hooks = 0;
int V3_send_raw(const char * pkt, uint32_t len) {
- V3_ASSERT(packet_hooks);
- V3_ASSERT(packet_hooks->send);
+ if(packet_hooks != NULL && packet_hooks->send != NULL){
+ return packet_hooks->send(pkt, len, NULL);
+ }
- return packet_hooks->send(pkt, len, NULL);
+ return -1;
}
-int V3_register_mac(const char mac[6], struct v3_vm_info * vm){
+int V3_packet_add_recver(const char * mac, struct v3_vm_info * vm){
+ if(packet_hooks != NULL && packet_hooks->add_recver != NULL){
+ return packet_hooks->add_recver(mac, vm);
+ }
- return packet_hooks->register_mac(mac, vm);
+ return -1;
+}
+
+
+int V3_packet_del_recver(const char * mac, struct v3_vm_info * vm){
+ if(packet_hooks != NULL && packet_hooks->del_recver != NULL){
+ return packet_hooks->del_recver(mac, vm);
+ }
+
+ return -1;
}
void V3_Init_Packet(struct v3_packet_hooks * hooks) {