OptionBufferConstIter begin,
OptionBufferConstIter end,
UnpackOptionsCallback callback) const {
+
try {
+ // Some of the options are represented by the specialized classes derived
+ // from Option class (e.g. IA_NA, IAADDR). Although, they can be also
+ // represented by the generic classes, we want the object of the specialized
+ // type to be returned. Therefore, we first check that if we are dealing
+ // with such an option. If the instance is returned we just exit at this
+ // point. If not, we will search for a generic option type to return.
+ OptionPtr option = factorySpecialFormatOption(u, begin, end, callback);
+ if (option) {
+ return (option);
+ }
+
switch(type_) {
case OPT_EMPTY_TYPE:
- return (factoryEmpty(u, type));
+ if (getEncapsulatedSpace().empty()) {
+ return (factoryEmpty(u, type));
+ } else {
+ return (OptionPtr(new OptionCustom(*this, u, begin, end)));
+ }
case OPT_BINARY_TYPE:
return (factoryGeneric(u, type, begin, end));