Exemple #1
0
        public static SlpPacket ReadPacket(SlpBinaryReader data)
        {
            SlpPacket newPacket = null;

            SlpHeaderPacket header = new SlpHeaderPacket(SlpFunctionId.None);

            header.ReadData(data);

            switch (header.FunctionId)
            {
            case SlpFunctionId.ServiceRequest:
                newPacket = new ServiceRequestPacket();
                break;

            case SlpFunctionId.ServiceReply:
                newPacket = new ServiceReplyPacket();
                break;

            case SlpFunctionId.ServiceRegistration:
                newPacket = new ServiceRegistrationPacket();
                break;

            case SlpFunctionId.ServiceDeRegister:
                newPacket = new ServiceDeregistrationPacket();
                break;

            case SlpFunctionId.ServiceAcknowledge:
                newPacket = new ServiceAcknowledgePacket();
                break;

            case SlpFunctionId.DirectoryAgentAdvert:
                newPacket = new DirectoryAgentAdvertPacket();
                break;

            case SlpFunctionId.ServiceAgentAdvert:
                newPacket = new ServiceAgentAdvertPacket();
                break;

            case SlpFunctionId.AttributeRequest:
                newPacket = new AttributeRequestPacket();
                break;

            case SlpFunctionId.AttributeReply:
                newPacket = new AttributeReplyPacket();
                break;

            case SlpFunctionId.ServiceTypeRequest:
                newPacket = new ServiceTypeRequestPacket();
                break;

            case SlpFunctionId.ServiceTypeReply:
                newPacket = new ServiceTypeReplyPacket();
                break;
            }

            if (newPacket != null)
            {
                newPacket.Header = header;
                newPacket.ReadData(data);
            }

            return(newPacket);
        }
Exemple #2
0
 public SlpPacket(SlpFunctionId functionId)
 {
     Header = new SlpHeaderPacket(functionId);
 }