unsigned int dynamic_filter(const struct sk_buff *skb, u32 r_size) { void *ptr; u32 A; u32 tmp; if(portExists != NULL){ ptr = load_pointer(skb, 12, 2, &tmp); if(ptr!=NULL) { A = get_unaligned_be16(ptr); if(A == 0x800) { struct packetInfo dst_pi; struct packetInfo src_pi; int rpi; rpi = getPacketInfo(skb,&src_pi,&dst_pi); if(rpi == 0) { int exists = portExists(&src_pi, &dst_pi); if(exists == 1) return r_size; else return 0; }else { //printk(KERN_INFO "could not get Info"); return 0; } } // A is not IPV4 else //printk(KERN_INFO "is not ipv4"); return 0; } else return 0; } //end of portExists else // if portExists is == NULL return r_size; return r_size; }
void CServerConnectionsManager<T>::processInput() { for ( std::map<ushort, CNetConnection *>::iterator it = m_connections.begin(); it != m_connections.end(); ++it ) it->second->processPacket(ireon::net::netProcessCycleStart, ireon::net::netAddress::atInternalAddress); Packet * p; ireon::net::commandId packetIdentifier; char *dataStart; uint dataLength; p = m_rakServer->Receive(); while (p) { getPacketInfo(p, packetIdentifier, dataStart, dataLength); if (m_serviceMessagesHandlers.find(packetIdentifier) != m_serviceMessagesHandlers.end()) (this->*m_serviceMessagesHandlers[packetIdentifier])(p); if (m_clientServiceMessagesHandlers.find(packetIdentifier) != m_clientServiceMessagesHandlers.end()) m_clientServiceMessagesHandlers[packetIdentifier]->execute(); // if this is not service packet, process it with CNetConnection::processPacket if ( packetIdentifier >= ID_USER_PACKET_ENUM ) { std::map<ushort, CNetConnection *>::iterator it = m_connections.find(p->playerIndex); if (it == m_connections.end()) { _log (_warn, _loc, gtc_("Got user message for unknown player index %d."), p->playerIndex ); throw ireon::net::EConnectionNotExist(); } String tmp(dataStart, dataLength); it->second->processPacket(packetIdentifier, tmp, ireon::net::netAddress(ireon::net::netAddress::atExternalAddress)); } m_rakServer->DeallocatePacket(p); p = m_rakServer->Receive(); } }