Share via


IWMSIPEntry.Mask (C#)

banner art

Previous Next

IWMSIPEntry.Mask (C#)

The Mask property specifies and retrieves an IP address mask.

Syntax

  IWMSIPEntry
  .Mask = string;
string = IWMSIPEntry.Mask;

Property Value

A string value containing the returned IP mask.

If this property fails, it throws an exception.

Number Description
0x80004005 The server cannot find an IP address entry list.
0x8007000E The server could not allocate memory.

Remarks

When the address, which is specified by the IWMSIPEntry.Address property, refers to a valid IPv6 address the mask must be set to a single numeric value representing the IPv6 prefix length. For example, if the IP address is 3FFE:5000::1, the mask might be set to 127. When the address refers to a valid IPv4 address the mask must be set using decimal notation. The server treats the mask as a 32-bit value. Each bit in the mask is compared to the corresponding bit in the IP address. When the bit value in the mask is 1, the corresponding bit in the IP address is included in the list. When the bit value in the mask is 0, all values are included. For example if the IP address in the list is 134.123.123.20 and the mask is 255.255.255.0 (that is, the bit fields are 11111111 11111111 11111111 00000000), all IP addresses from 134.123.123.0 to 134.123.123.255 are included in the list.

Example Code

using Microsoft.WindowsMediaServices.Interop;
using System.Runtime.InteropServices;

// Declare variables.
WMSServer Server;
IWMSPlugin Plugin;
IWMSIPAdmin IPAdmin;
IWMSIPList IPList;
IWMSIPEntry IPEntry;
string strMask;

try {
    // Create a new WMSServer object.
    Server = new WMSServerClass();

    // Retrieve the plug-in to be configured.
    Plugin = Server.EventHandlers[
                       "WMS IP Address Authorization"];

    // Retrieve the custom interface of the plug-in.
    IPAdmin = (IWMSIPAdmin)Plugin.CustomInterface;

    // Retrieve the list of banned IP addresses.
    IPList = IPAdmin.DisallowIP;

    // Retrieve the information associated
    // with each banned address.
    for(int i = 0; i < IPList.Count; i++)
    {
        IPEntry = IPList[i];
        strMask = IPEntry.Mask;
    }
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

Requirements

Reference: Add a reference to Microsoft.WindowsMediaServices.

Namespace: Microsoft.WindowsMediaServices.Interop.

Assembly: Microsoft.WindowsMediaServices.dll.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003 family, Windows Server 2008 family.

See Also

Previous Next