/// Version 1.0.0 /// Last modified 23.5.2014 /// /// Copyright (C) 2014 Veli-Mikko Puupponen /// /// Halyri-system is a prototype emergency call system. Its purpose is to /// demonstrate the use of the advanced capabilities available in the current /// generation smartphones in facilitating the emergency service dispatcher's /// capability to determine the nature of the emergency and to dispatch help. /// /// For more information, see the README file of this package. /// /// The MIT License (MIT) /// /// Permission is hereby granted, free of charge, to any person obtaining a copy /// of this software and associated documentation files (the "Software"), to /// deal in the Software without restriction, including without limitation the /// rights to use, copy, modify, merge, publish, distribute, sublicense, /// and/or sell copies of the Software, and to permit persons to whom the /// Software is furnished to do so, subject to the following conditions: /// /// The above copyright notice and this permission notice shall be included in /// all copies or substantial portions of the Software. /// /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING /// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS /// IN THE SOFTWARE. /// using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SimpleUdpMediaClient.Packets { /// Veli-Mikko Puupponen /// /// The class interface represents a network level packet. It exposes methods for /// converting the packet from and to a byte array representation /// for network transfer. /// public interface INetworkPacket { /// /// The function converts this packet to a byte array for network transfer. The specified /// seqeuence number will be used in the packet header. /// /// It throws an ArgumentException if the packet is not in a properly initializes state. /// /// The packet sequence number for the transfer header. /// A byte array containing data and transfer header for the packet. byte[] GetBytes(Int64 sequence); /// /// The function converts this packet to a byte array for network transfer. The sequence /// number specified in the packet will be used. /// /// It throws an ArgumentException if the packet is not in a properly initializes state. /// /// A byte array containing data and transfer header for this packet. byte[] GetBytes(); /// /// The function sets the state of this packet from the provided array of bytes. /// If the array does not containt a valid byte representation of the /// type of packet, It throws an ArgumentException. /// /// It throws an ArgumentException if the provided array does not containt a valid /// byte repsentation of the packet type. /// /// The byte representation of a packet with the same /// type as this packet. void FromBytes(byte[] packetBytes); } }