Exemplo n.º 1
0
 /// <summary>
 /// MIHProtocol of a Old link identifier.
 /// </summary>
 /// <param name="linkTuppleId">Link_Tuple_Id as the Old Link Identifier.</param>
 /// <returns>The Old Link Identifier Serialization.</returns>
 public static byte[] TLVOldLinkIdentifier(Link_Tuple_Id linkTuppleId)
 {
     return Serialization.SerializeToTLV(TLV_VALUES.TLV_LINK_IDENTIFIER, linkTuppleId.ByteValue);
 }
Exemplo n.º 2
0
        private static Link_Parameters_Report ReportBuilder(ushort subType, ushort value)
        {
            //Link Identification Information
            Link_Addr linkAddr = new Link_Addr(Link_Addr.Address_Type.MAC_ADDR, Information.GenericInfo.PhysicalAddress.ToString());
            Link_Id linkId = new Link_Id(linkType, linkAddr);
            Link_Tuple_Id linkTuppleId = new Link_Tuple_Id(linkId, linkAddr);
            Link_Tuple_Id nicTupple = new Link_Tuple_Id(linkId, linkAddr);

            //Specified Parameter information and report building
            List<Link_Param_Rpt> paramsList = new List<Link_Param_Rpt>();
            Link_Param_Type linkParamType = new Link_Param_Type(Link_Param_Types.LINK_PARAM_GEN, subType);
            Link_Param linkParam = new Link_Param(linkParamType, value);
            Link_Param_Rpt reportSingle = new Link_Param_Rpt(linkParam, null);
            paramsList.Add(reportSingle);
            return new Link_Parameters_Report(nicTupple, paramsList);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Link_Parameters_Report class constructor.
 /// </summary>
 /// <param name="LinkIdentifier">The Link Identifier.</param>
 /// <param name="LinkParametersReportList">The Link Parameter Report List.</param>
 public Link_Parameters_Report(Link_Tuple_Id LinkIdentifier, List<Link_Param_Rpt> LinkParametersReportList)
 {
     this.LinkIdentifier = LinkIdentifier;
     this.LinkParametersReportList = LinkParametersReportList;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Generates a Link_Parameters_Report.Indication message, reporting the specified value of the specified parameter type.
        /// </summary>
        /// <param name="src">The source MIHF ID</param>
        /// <param name="dst">The destination MIHF ID</param>
        /// <param name="APMac">The Physical Address of the Access Point (corresponding to the active link)</param>
        /// <param name="networkSSID">The SSID for the active link</param>
        /// <param name="paramType">The type of parameter to report</param>
        /// <param name="value">The value of the parameter</param>
        /// <returns>A Link_Parameters_Report.Indication message ready to be sent.</returns>
        public static Message Link_Parameters_Report_Indication_MsgBuilder(ID src, ID dst, PhysicalAddress APMac, byte[] networkSSID, Link_Param_Abs_Type paramType, ushort value )
        {
            Message m = new Message();
            m.MIHHeader = new MIHHeader();
            m.MIHHeader.MID = new MessageID(MessageID.ServiceIdentifier.EVENT_SERVICE, MessageID.OperationCode.INDICATION, 5);
            m.MIHHeader.VersionValue = 1;
            Link_Tuple_Id linkIdentifier = new Link_Tuple_Id(
                        new Link_Id(Link_Type.Wireless_IEEE80211, new Link_Addr(Link_Addr.Address_Type.MAC_ADDR, Utilities.PhysicalAddressToString(APMac))),
                        new Link_Addr(Link_Addr.Address_Type.OTHER_L2_ADDR, new String(Encoding.ASCII.GetChars(networkSSID))));

            Link_Param_Rpt lpr = new Link_Param_Rpt(
                                    new Link_Param(
                                        Link_Param_Type.FromAbsType(paramType),
                                        (ushort)value,
                                        0 /*TODO 0=LinkParamVal (choice)*/),
                                    null);
            List<byte[]> lprList = new List<byte[]>();
            lprList.Add(lpr.ByteValue);

            m.Payload = new Payload(src,
                                    dst,
                                    Serialization.SerializeToTLV(TLV_VALUES.TLV_LINK_IDENTIFIER, linkIdentifier.ByteValue),
                                    Serialization.SerializeToTLV(TLV_VALUES.TLV_LINK_PARAM_REPORT_LIST, Serialization.EncodingList(lprList.ToArray())));
            m.MIHHeader.PayloadLength = (ushort)m.Payload.PayloadValue.Length;
            return m;
        }
Exemplo n.º 5
0
 /// <summary>
 /// Generates an 802.21-encoded message representing a LinkUp Event.
 /// </summary>
 /// <param name="srcID">The local node ID</param>
 /// <param name="dstID">The destination MIHF ID</param>
 /// <param name="ssid">The SSID of the established connection</param>
 /// <param name="PoAMac">The Physical Address for the Point of Access</param>
 /// <returns>A fully encoded, ready to be sent Message representing a LinkUp</returns>
 public static Message Link_Up_Indication_MsgBuilder(ID srcID, ID dstID, String ssid, PhysicalAddress PoAMac)
 {
     Message m = new Message();
     m.MIHHeader = new MIHHeader();
     m.MIHHeader.MID = new MessageID(MessageID.ServiceIdentifier.EVENT_SERVICE, MessageID.OperationCode.INDICATION, 2);
     m.MIHHeader.VersionValue = 1;
     Link_Tuple_Id linkIdentifier = new Link_Tuple_Id(
                 new Link_Id(Link_Type.Wireless_IEEE80211, new Link_Addr(Link_Addr.Address_Type.OTHER_L2_ADDR, ssid)),
                 new Link_Addr(Link_Addr.Address_Type.MAC_ADDR, Utilities.PhysicalAddressToString(PoAMac)));
     m.Payload = new Payload(srcID,
                             dstID,
                             TLV_HELPERS.TLVLinkIdentifier(linkIdentifier));
     m.MIHHeader.PayloadLength = (ushort)m.Payload.PayloadValue.Length;
     return m;
 }
Exemplo n.º 6
0
        /// <summary>
        /// Generates an 802.21-encoded message representing a LinkDown Event.
        /// </summary>
        /// <param name="srcID">The local node ID</param>
        /// <param name="dstID">The destination MIHF ID</param>
        /// <param name="imsi">The IMSI (International Mobile Subscriber Identity) for this network</param>
        /// <param name="PoAMac">The Physical Address for the Point of Access</param>
        /// <param name="reason">The reason for the disconnect</param>
        /// <returns>A fully encoded, ready to be sent Message representing a LinkDown</returns>
        public static Message Link_Down_Indication_3G_MsgBuilder(ID srcID, ID dstID, String imsi, PhysicalAddress PoAMac, Link_Dn_Reason reason)
        {
            Message m = new Message();
            m.MIHHeader = new MIHHeader();
            m.MIHHeader.MID = new MessageID(MessageID.ServiceIdentifier.EVENT_SERVICE, MessageID.OperationCode.INDICATION, 3);
            m.MIHHeader.VersionValue = 1;
            Link_Tuple_Id linkIdentifier = new Link_Tuple_Id(
                        new Link_Id(Link_Type.Wireless_UMTS, new Link_Addr(Link_Addr.Address_Type._3GPP_ADDR, imsi)),
                        new Link_Addr(Link_Addr.Address_Type.MAC_ADDR, Utilities.PhysicalAddressToString(PoAMac)));
            Link_Dn_Reason downReason = reason;

            m.Payload = new Payload(srcID, dstID,
                TLV_HELPERS.TLVLinkIdentifier(linkIdentifier), TLV_HELPERS.TLVLinkDnReason(downReason));
            m.MIHHeader.PayloadLength = (ushort)m.Payload.PayloadValue.Length;
            return m;
        }
Exemplo n.º 7
0
 /// <summary>
 /// The Link Event Base Class constructor.
 /// </summary>
 /// <param name="LinkIdentifier"></param>
 public Link_Event(Link_Tuple_Id LinkIdentifier)
 {
     this.LinkIdentifier = LinkIdentifier;
 }
Exemplo n.º 8
0
 /// <summary>
 /// The Link Down Event Class constructor.
 /// </summary>
 /// <param name="LinkIdentifier">The Link Identifier.</param>
 /// <param name="OldAccessRouter">The Old Access Router Address.</param>
 /// <param name="ReasonCode">The Reason Code, for the link down event.</param>
 public Link_Down(Link_Tuple_Id LinkIdentifier, Link_Addr OldAccessRouter, Link_Dn_Reason ReasonCode)
     : base(LinkIdentifier)
 {
     this.OldAccessRouter = OldAccessRouter;
     this.ReasonCode = ReasonCode;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Normal constructor for this object.
 /// </summary>
 /// <param name="lti">The link detected.</param>
 /// <param name="nid">The access network identifier if applicable.</param>
 /// <param name="naid">An auxiliary access network identifier if applicable.</param>
 /// <param name="sigStrPc">The signal strength of the detected link (in percentage).</param>
 /// <param name="sigStrDbm">The signal strength of the detected link (in dBm).</param>
 /// <param name="sinr">The Signal/Noise ratio.</param>
 /// <param name="ldr">The maximum transmission rate on the detected link.</param>
 /// <param name="lmcf">Indicates which MIH capabilities are supported on the detected link.</param>
 /// <param name="nc">The network capabilities supported by the network link.</param>
 public Link_Det_Info(Link_Tuple_Id lti, OctetString nid, OctetString naid, uint sigStrPc, int sigStrDbm, int sinr, int ldr, Link_MIHCap_Flag lmcf, Net_Caps nc)
 {
     this.LinkTuppleId = lti;
     this.NetworkID = nid;
     this.NetworkAuxId = naid;
     this.SigStrInPc = sigStrPc;
     this.SigStrInDbm = sigStrDbm;
     this.SINR = sinr;
     this.LinkDataRate = ldr;
     this.LinkMIHCapFlag = lmcf;
     this.NetCaps = nc;
 }
Exemplo n.º 10
0
 //IPRenewalFlag Not Implemented in this version
 //MobilityManagementSupport Not Implemented in this version
 /// <summary>
 /// Link UP Event Class constructor.
 /// </summary>
 /// <param name="LinkIdentifier">The Link Identifier.</param>
 /// <param name="OldAccessRouter">The Old Access Router Address.</param>
 /// <param name="NewAccessRouter">The New Access Router Address.</param>
 public Link_Up(Link_Tuple_Id LinkIdentifier, Link_Addr OldAccessRouter, Link_Addr NewAccessRouter)
     : base(LinkIdentifier)
 {
     this.NewAccessRouter = NewAccessRouter;
     this.OldAccessRouter = OldAccessRouter;
 }