fn into_service_table_element(
        self) -> Result<ServiceTableElement, ConfigError> {
        let svc = match self.svc_type {
            SVC_TYPE_CONTROL_PROTOCOL => Ok(Service::ControlProtocol),
            SVC_TYPE_RTSP => Ok(Service::RTSP(
                try!(MacAddr::from_str(&self.mac)),
                try!(parse_socket_addr(&self.address)), self.path)),
            SVC_TYPE_LOCKED_RTSP => Ok(Service::LockedRTSP(
                try!(MacAddr::from_str(&self.mac)),
                try!(parse_socket_addr(&self.address)))),
            SVC_TYPE_UNKNOWN_RTSP => Ok(Service::UnknownRTSP(
                try!(MacAddr::from_str(&self.mac)),
                try!(parse_socket_addr(&self.address)))),
            SVC_TYPE_UNSUPPORTED_RTSP => Ok(Service::UnsupportedRTSP(
                try!(MacAddr::from_str(&self.mac)),
                try!(parse_socket_addr(&self.address)), self.path)),
            SVC_TYPE_HTTP => Ok(Service::HTTP(
                try!(MacAddr::from_str(&self.mac)),
                try!(parse_socket_addr(&self.address)))),
            SVC_TYPE_MJPEG => Ok(Service::MJPEG(
                try!(MacAddr::from_str(&self.mac)),
                try!(parse_socket_addr(&self.address)), self.path)),
            SVC_TYPE_LOCKED_MJPEG => Ok(Service::LockedMJPEG(
                try!(MacAddr::from_str(&self.mac)),
                try!(parse_socket_addr(&self.address)))),
            SVC_TYPE_TCP => Ok(Service::TCP(
                try!(MacAddr::from_str(&self.mac)),
                try!(parse_socket_addr(&self.address)))),
            _ => Err(ConfigError::from("unknown service type"))
        };

        let static_svc = self.static_svc.unwrap_or(false);
        let last_seen  = self.last_seen.unwrap_or(get_utc_timestamp());
        let active     = self.active.unwrap_or(true);

        let elem = ServiceTableElement {
            service_id:     0,
            service:        try!(svc),
            static_service: static_svc,
            last_seen:      last_seen,
            active:         active
        };

        Ok(elem)
    }
/// Transform this service description into a service table element.
Transform this service description into a service table element.
Transform this service description into a service table element .
fn into_service_table_element(
        self) -> Result<ServiceTableElement, ConfigError> {
        let svc = match self.svc_type {
            SVC_TYPE_CONTROL_PROTOCOL => Ok(Service::ControlProtocol),
            SVC_TYPE_RTSP => Ok(Service::RTSP(
                try!(MacAddr::from_str(&self.mac)),
                try!(parse_socket_addr(&self.address)), self.path)),
            SVC_TYPE_LOCKED_RTSP => Ok(Service::LockedRTSP(
                try!(MacAddr::from_str(&self.mac)),
                try!(parse_socket_addr(&self.address)))),
            SVC_TYPE_UNKNOWN_RTSP => Ok(Service::UnknownRTSP(
                try!(MacAddr::from_str(&self.mac)),
                try!(parse_socket_addr(&self.address)))),
            SVC_TYPE_UNSUPPORTED_RTSP => Ok(Service::UnsupportedRTSP(
                try!(MacAddr::from_str(&self.mac)),
                try!(parse_socket_addr(&self.address)), self.path)),
            SVC_TYPE_HTTP => Ok(Service::HTTP(
                try!(MacAddr::from_str(&self.mac)),
                try!(parse_socket_addr(&self.address)))),
            SVC_TYPE_MJPEG => Ok(Service::MJPEG(
                try!(MacAddr::from_str(&self.mac)),
                try!(parse_socket_addr(&self.address)), self.path)),
            SVC_TYPE_LOCKED_MJPEG => Ok(Service::LockedMJPEG(
                try!(MacAddr::from_str(&self.mac)),
                try!(parse_socket_addr(&self.address)))),
            SVC_TYPE_TCP => Ok(Service::TCP(
                try!(MacAddr::from_str(&self.mac)),
                try!(parse_socket_addr(&self.address)))),
            _ => Err(ConfigError::from("unknown service type"))
        };
        let static_svc = self.static_svc.unwrap_or(false);
        let last_seen  = self.last_seen.unwrap_or(get_utc_timestamp());
        let active     = self.active.unwrap_or(true);
        let elem = ServiceTableElement {
            service_id:     0,
            service:        try!(svc),
            static_service: static_svc,
            last_seen:      last_seen,
            active:         active
        };
        Ok(elem)
    }
fn into_service_table_element ( self ) -> Result < ServiceTableElement , ConfigError > { let svc = match self . svc_type { SVC_TYPE_CONTROL_PROTOCOL => Ok ( Service :: ControlProtocol ) , SVC_TYPE_RTSP => Ok ( Service :: RTSP ( try ! ( MacAddr from_str ( self mac ) ) , try ! ( parse_socket_addr ( self address ) ) , self . path ) ) , SVC_TYPE_LOCKED_RTSP => Ok ( Service :: LockedRTSP ( try ! ( MacAddr from_str ( self mac ) ) , try ! ( parse_socket_addr ( self address ) ) ) ) , SVC_TYPE_UNKNOWN_RTSP => Ok ( Service :: UnknownRTSP ( try ! ( MacAddr from_str ( self mac ) ) , try ! ( parse_socket_addr ( self address ) ) ) ) , SVC_TYPE_UNSUPPORTED_RTSP => Ok ( Service :: UnsupportedRTSP ( try ! ( MacAddr from_str ( self mac ) ) , try ! ( parse_socket_addr ( self address ) ) , self . path ) ) , SVC_TYPE_HTTP => Ok ( Service :: HTTP ( try ! ( MacAddr from_str ( self mac ) ) , try ! ( parse_socket_addr ( self address ) ) ) ) , SVC_TYPE_MJPEG => Ok ( Service :: MJPEG ( try ! ( MacAddr from_str ( self mac ) ) , try ! ( parse_socket_addr ( self address ) ) , self . path ) ) , SVC_TYPE_LOCKED_MJPEG => Ok ( Service :: LockedMJPEG ( try ! ( MacAddr from_str ( self mac ) ) , try ! ( parse_socket_addr ( self address ) ) ) ) , SVC_TYPE_TCP => Ok ( Service :: TCP ( try ! ( MacAddr from_str ( self mac ) ) , try ! ( parse_socket_addr ( self address ) ) ) ) , _ => Err ( ConfigError :: from ( " " ) ) } ; let static_svc = self . static_svc . unwrap_or ( false ) ; let last_seen = self . last_seen . unwrap_or ( get_utc_timestamp ( ) ) ; let active = self . active . unwrap_or ( true ) ; let elem = ServiceTableElement { service_id : 0 , service : try ! ( svc ) , static_service : static_svc , last_seen : last_seen , active : active } ; Ok ( elem ) }
Transform this service description into a service table element.
Transform this service description into a service table element .
self
self