Browse Source

[5096] [4096] Spit bison type rule, removed server-id

Francis Dupont 8 years ago
parent
commit
fbb1008eee

+ 1 - 48
src/bin/dhcp4/dhcp4_lexer.ll

@@ -1,4 +1,4 @@
-/* Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
+/* Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC")
 
    This Source Code Form is subject to the terms of the Mozilla Public
    License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -237,7 +237,6 @@ ControlCharacterFill            [^"\\]|\\{JSONEscapeSequence}
     case isc::dhcp::Parser4Context::LEASE_DATABASE:
     case isc::dhcp::Parser4Context::HOSTS_DATABASE:
     case isc::dhcp::Parser4Context::OPTION_DEF:
-    case isc::dhcp::Parser4Context::SERVER_ID:
         return isc::dhcp::Dhcp4Parser::make_TYPE(driver.loc_);
     default:
         return isc::dhcp::Dhcp4Parser::make_STRING("type", driver.loc_);
@@ -278,7 +277,6 @@ ControlCharacterFill            [^"\\]|\\{JSONEscapeSequence}
     switch(driver.ctx_) {
     case isc::dhcp::Parser4Context::LEASE_DATABASE:
     case isc::dhcp::Parser4Context::HOSTS_DATABASE:
-    case isc::dhcp::Parser4Context::SERVER_ID:
         return isc::dhcp::Dhcp4Parser::make_PERSIST(driver.loc_);
     default:
         return isc::dhcp::Dhcp4Parser::make_STRING("persist", driver.loc_);
@@ -716,51 +714,6 @@ ControlCharacterFill            [^"\\]|\\{JSONEscapeSequence}
     }
 }
 
-\"server-id\" {
-    switch(driver.ctx_) {
-    case isc::dhcp::Parser4Context::DHCP4:
-        return isc::dhcp::Dhcp4Parser::make_SERVER_ID(driver.loc_);
-    default:
-        return isc::dhcp::Dhcp4Parser::make_STRING("server-id", driver.loc_);
-    }
-}
-
-\"identifier\" {
-    switch(driver.ctx_) {
-    case isc::dhcp::Parser4Context::SERVER_ID:
-        return isc::dhcp::Dhcp4Parser::make_IDENTIFIER(driver.loc_);
-    default:
-        return isc::dhcp::Dhcp4Parser::make_STRING("identifier", driver.loc_);
-    }
-}
-
-\"htype\" {
-    switch(driver.ctx_) {
-    case isc::dhcp::Parser4Context::SERVER_ID:
-        return isc::dhcp::Dhcp4Parser::make_HTYPE(driver.loc_);
-    default:
-        return isc::dhcp::Dhcp4Parser::make_STRING("htype", driver.loc_);
-    }
-}
-
-\"time\" {
-    switch(driver.ctx_) {
-    case isc::dhcp::Parser4Context::SERVER_ID:
-        return isc::dhcp::Dhcp4Parser::make_TIME(driver.loc_);
-    default:
-        return isc::dhcp::Dhcp4Parser::make_STRING("time", driver.loc_);
-    }
-}
-
-\"enterprise-id\" {
-    switch(driver.ctx_) {
-    case isc::dhcp::Parser4Context::SERVER_ID:
-        return isc::dhcp::Dhcp4Parser::make_ENTERPRISE_ID(driver.loc_);
-    default:
-        return isc::dhcp::Dhcp4Parser::make_STRING("enterprise-id", driver.loc_);
-    }
-}
-
 \"expired-leases-processing\" {
     switch(driver.ctx_) {
     case isc::dhcp::Parser4Context::DHCP4:

+ 11 - 59
src/bin/dhcp4/dhcp4_parser.yy

@@ -1,4 +1,4 @@
-/* Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
+/* Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC")
 
    This Source Code Form is subject to the terms of the Mozilla Public
    License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -121,12 +121,6 @@ using namespace std;
 
   EXPIRED_LEASES_PROCESSING "expired-leases-processing"
 
-  SERVER_ID "server-id"
-  IDENTIFIER "identifier"
-  HTYPE "htype"
-  TIME "time"
-  ENTERPRISE_ID "enterprise-id"
-
   DHCP4O6_PORT "dhcp4o6-port"
 
   CONTROL_SOCKET "control-socket"
@@ -366,7 +360,6 @@ global_param: valid_lifetime
             | option_data_list
             | hooks_libraries
             | expired_leases_processing
-            | server_id
             | dhcp4o6_port
             | control_socket
             | dhcp_ddns
@@ -475,7 +468,7 @@ database_map_params: database_map_param
                    | database_map_params COMMA database_map_param
                    ;
 
-database_map_param: type
+database_map_param: database_type
                   | user
                   | password
                   | host
@@ -486,7 +479,7 @@ database_map_param: type
                   | unknown_map_entry
 ;
 
-type: TYPE {
+database_type: TYPE {
     ctx.enter(ctx.NO_KEYWORD);
 } COLON STRING {
     ElementPtr prf(new StringElement($4, ctx.loc2pos(@4)));
@@ -897,7 +890,13 @@ code: CODE COLON INTEGER {
 
 option_def_code: code;
 
-option_def_type: type;
+option_def_type: TYPE {
+    ctx.enter(ctx.NO_KEYWORD);
+} COLON STRING {
+    ElementPtr prf(new StringElement($4, ctx.loc2pos(@4)));
+    ctx.stack_.back()->set("type", prf);
+    ctx.leave();
+};
 
 option_def_record_types: RECORD_TYPES {
     ctx.enter(ctx.NO_KEYWORD);
@@ -1293,54 +1292,7 @@ client_class_test: TEST {
 
 // --- end of client classes ---------------------------------
 
-// --- server-id ---------------------------------------------
-server_id: SERVER_ID {
-    ElementPtr m(new MapElement(ctx.loc2pos(@1)));
-    ctx.stack_.back()->set("server-id", m);
-    ctx.stack_.push_back(m);
-    ctx.enter(ctx.SERVER_ID);
-} COLON LCURLY_BRACKET server_id_params RCURLY_BRACKET {
-    ctx.stack_.pop_back();
-    ctx.leave();
-};
-
-server_id_params: server_id_param
-                | server_id_params COMMA server_id_param
-                ;
-
-server_id_param: type
-               | identifier
-               | time
-               | htype
-               | enterprise_id
-               | persist
-               | unknown_map_entry
-               ;
-
-htype: HTYPE COLON INTEGER {
-    ElementPtr htype(new IntElement($3, ctx.loc2pos(@3)));
-    ctx.stack_.back()->set("htype", htype);
-};
-
-identifier: IDENTIFIER {
-    ctx.enter(ctx.NO_KEYWORD);
-} COLON STRING {
-    ElementPtr id(new StringElement($4, ctx.loc2pos(@4)));
-    ctx.stack_.back()->set("identifier", id);
-    ctx.leave();
-};
-
-time: TIME COLON INTEGER {
-    ElementPtr time(new IntElement($3, ctx.loc2pos(@3)));
-    ctx.stack_.back()->set("time", time);
-};
-
-enterprise_id: ENTERPRISE_ID COLON INTEGER {
-    ElementPtr time(new IntElement($3, ctx.loc2pos(@3)));
-    ctx.stack_.back()->set("enterprise-id", time);
-};
-
-// --- end of server-id --------------------------------------
+// was server-id but in is DHCPv6-only
 
 dhcp4o6_port: DHCP4O6_PORT COLON INTEGER {
     ElementPtr time(new IntElement($3, ctx.loc2pos(@3)));

+ 0 - 2
src/bin/dhcp4/parser_context.cc

@@ -143,8 +143,6 @@ Parser4Context::contextName()
         return ("option-data");
     case CLIENT_CLASSES:
         return ("client-classes");
-    case SERVER_ID:
-        return ("server-id");
     case CONTROL_SOCKET:
         return ("control-socket");
     case POOLS:

+ 1 - 4
src/bin/dhcp4/parser_context.h

@@ -1,4 +1,4 @@
-// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2017 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -219,9 +219,6 @@ public:
         /// Used while parsing Dhcp4/client-classes structures.
         CLIENT_CLASSES,
 
-        /// Used while parsing Dhcp4/server-id structures.
-        SERVER_ID,
-
         /// Used while parsing Dhcp4/control-socket structures.
         CONTROL_SOCKET,