#pragma once

#include <util/network/ip.h>
#include <util/generic/yexception.h>

namespace NProtoConfig {
    inline
    void ParseConfigValue(ui32 config, TIpPort& value) {
        if (config > Max<TIpPort>() || 0 == config) {
            ythrow yexception() << "invalid port value " << config;
        }
        value = static_cast<TIpPort>(config);
    }
}
