<?php

namespace MGModule\DNSManager2\mgLibs\custom\dns\record\type;

class WKS extends RecordTypeAbstract {
    /**
     * An 32 bit Internet address
     */
    public $address;
    /**
     * An 8 bit IP protocol number
     */
    public $protocol;
    /**
     * A variable length bit map.  The bit map must be a multiple of 8 bits long.
     */
    public $bitmap;
    /**
     * @param string $address Ipv4 address
     * @return bool
     */
    public function addressValidate($address)
    {
        return filter_var($address,FILTER_VALIDATE_IP,FILTER_FLAG_IPV4);
    }
    /**
     * @param int $protocol valid number 0-255
     * @return bool
     */
    public function protocolValidate($protocol)
    {
        if(is_numeric(trim($protocol))){
            return ((int)$protocol >= 0 && (int)$protocol <= 255);
        }
        return (bool)$protocol;
    }
}