Esempio n. 1
0
        private static void V6Release()
        {
            DhcpV6Message msg = new DhcpV6Message(IPAddress.Any, new IPEndPoint(serverAddr, serverPort));

            msg.SetTransactionId(-1729018559);

            DhcpV6ClientIdOption dhcpClientId = new DhcpV6ClientIdOption();

            dhcpClientId.GetOpaqueData().SetAscii("000100011dd31327001dbac1557b");
            msg.PutDhcpOption(dhcpClientId);

            DhcpV6ServerIdOption dhcpServerId = new DhcpV6ServerIdOption();

            dhcpServerId.GetOpaqueData().SetAscii("000100011dd31327001dbac1557b");
            msg.PutDhcpOption(dhcpServerId);
            msg.SetMessageType(DhcpConstants.V6MESSAGE_TYPE_RELEASE);
            msg.SetIaNaOptions(new List <DhcpV6IaNaOption>()
            {
                new DhcpV6IaNaOption(new v6IaNaOption()
                {
                    iaId = 285220282, t1 = 0, t2 = 0
                })
            });
            var message = DhcpV6MessageHandler.HandleMessage(
                serverAddr, msg);

            Console.WriteLine(message.ToString());
        }
Esempio n. 2
0
 public override DhcpV6Message AddOtherOptions(DhcpV6Message dhcpV6MessagePacket)
 {
     dhcpV6MessagePacket.SetMessageType(DhcpConstants.V6MESSAGE_TYPE_SOLICIT);
     dhcpV6MessagePacket.SetIaNaOptions(new List <DhcpV6IaNaOption>()
     {
         new DhcpV6IaNaOption(new v6IaNaOption()
         {
             iaId = 285220282, t1 = 0, t2 = 0
         })
     });
     return(dhcpV6MessagePacket);
 }
Esempio n. 3
0
        public override DhcpV6Message AddOtherOptions(DhcpV6Message dhcpV6MessagePacket)
        {
            DhcpV6Message replyDhcpV6Message = new DhcpV6Message(null, null);

            byte[] replyData = _replyPacke.GetData();
            replyDhcpV6Message.Decode(ByteBuffer.allocate(replyData.Length).put(replyData).flip());

            dhcpV6MessagePacket.SetMessageType(DhcpConstants.V6MESSAGE_TYPE_REQUEST);
            dhcpV6MessagePacket.PutDhcpOption(replyDhcpV6Message.GetDhcpServerIdOption());
            dhcpV6MessagePacket.SetIaNaOptions(replyDhcpV6Message.GetIaNaOptions());

            return(dhcpV6MessagePacket);
        }