using System; using System.Net; using OpenMetaverse; using OpenMetaverse.Packets; namespace Simian { public enum PacketCategory { /// Any sort of transactional message, such as /// AgentMovementComplete Transaction = 0, /// Chat such as intra-simulator chat or instant /// messaging Messaging, /// State synchronization, such as animations or /// object updates State, /// State synchronization of inventory Inventory, /// State synchronization of terrain, LayerData /// packets Terrain, /// Asset transfer packets Asset, /// Texture transfer packets Texture, /// Protocol overhead such as PacketAck Overhead, } /// /// Coupled with RegisterCallback(), this is triggered whenever a packet /// of a registered type is received /// public delegate void PacketCallback(Packet packet, Agent agent); /// /// Triggered whenever a packet is going to be sent out to one or more /// clients /// /// The packet that will be sent out /// The UUID of the agent receiving this packet. Equal /// to UUID.Zero if this packet will be broadcast to all connected agents /// The specified category of the outgoing packet /// True to continue sending this packet, otherwise false public delegate bool OutgoingPacketCallback(Packet packet, UUID agentID, PacketCategory category); public interface IUDPProvider { event OutgoingPacketCallback OnOutgoingPacket; void AddClient(Agent agent, IPEndPoint endpoint); bool RemoveClient(Agent agent); uint CreateCircuit(Agent agent); void SendPacket(UUID agentID, Packet packet, PacketCategory category); void BroadcastPacket(Packet packet, PacketCategory category); void RegisterPacketCallback(PacketType type, PacketCallback callback); } }