Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Kea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastian Schrader
Kea
Commits
3b4db076
Commit
3b4db076
authored
Oct 23, 2017
by
Francis Dupont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[5389] Addressed warnings, moved to boost coroutines
parent
7feedc09
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
52 additions
and
218 deletions
+52
-218
COPYING
COPYING
+0
-6
Makefile.am
Makefile.am
+0
-4
configure.ac
configure.ac
+0
-4
ext/Makefile.am
ext/Makefile.am
+1
-1
ext/coroutine/LICENSE_1_0.txt
ext/coroutine/LICENSE_1_0.txt
+0
-23
ext/coroutine/Makefile.am
ext/coroutine/Makefile.am
+0
-1
ext/coroutine/coroutine.h
ext/coroutine/coroutine.h
+0
-133
m4macros/ax_boost_for_kea.m4
m4macros/ax_boost_for_kea.m4
+1
-1
src/bin/agent/agent_lexer.ll
src/bin/agent/agent_lexer.ll
+1
-0
src/bin/d2/d2_lexer.ll
src/bin/d2/d2_lexer.ll
+1
-0
src/bin/dhcp4/dhcp4_lexer.ll
src/bin/dhcp4/dhcp4_lexer.ll
+1
-0
src/bin/dhcp6/dhcp6_lexer.ll
src/bin/dhcp6/dhcp6_lexer.ll
+1
-0
src/lib/asiodns/io_fetch.cc
src/lib/asiodns/io_fetch.cc
+10
-10
src/lib/asiodns/io_fetch.h
src/lib/asiodns/io_fetch.h
+3
-3
src/lib/asiolink/io_asio_socket.h
src/lib/asiolink/io_asio_socket.h
+2
-1
src/lib/cc/data.cc
src/lib/cc/data.cc
+3
-4
src/lib/cc/data.h
src/lib/cc/data.h
+7
-7
src/lib/cc/json_feed.cc
src/lib/cc/json_feed.cc
+2
-1
src/lib/config/module_spec.cc
src/lib/config/module_spec.cc
+4
-4
src/lib/config/module_spec.h
src/lib/config/module_spec.h
+7
-7
src/lib/dhcp/tests/option_custom_unittest.cc
src/lib/dhcp/tests/option_custom_unittest.cc
+3
-3
src/lib/dhcp/tests/option_data_types_unittest.cc
src/lib/dhcp/tests/option_data_types_unittest.cc
+3
-3
src/lib/log/message_exception.h
src/lib/log/message_exception.h
+2
-2
No files found.
COPYING
View file @
3b4db076
...
@@ -7,12 +7,6 @@ text is also included below.
...
@@ -7,12 +7,6 @@ text is also included below.
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
The ext/coroutine code is externally maintained and distributed under
the Boost Software License, Version 1.0. (See its accompanying file
ext/coroutine/LICENSE_1_0.txt.)
-----------------------------------------------------------------------------
The Cassandra backend code is distributed under the Apache License, Version 2.0.
The Cassandra backend code is distributed under the Apache License, Version 2.0.
The text is available at http://www.apache.org/licenses/LICENSE-2.0. Full
The text is available at http://www.apache.org/licenses/LICENSE-2.0. Full
text is also included below in this file.
text is also included below in this file.
...
...
Makefile.am
View file @
3b4db076
...
@@ -77,7 +77,6 @@ report-cpp-coverage:
...
@@ -77,7 +77,6 @@ report-cpp-coverage:
if
HAVE_BOTAN
if
HAVE_BOTAN
botan/
\*
\
botan/
\*
\
endif
endif
ext/coroutine/
\*
\
gtest/
\*
\
gtest/
\*
\
include/
\*
\
include/
\*
\
log4cplus/
\*
\
log4cplus/
\*
\
...
@@ -120,9 +119,6 @@ install-exec-hook:
...
@@ -120,9 +119,6 @@ install-exec-hook:
EXTRA_DIST
=
tools/path_replacer.sh
EXTRA_DIST
=
tools/path_replacer.sh
EXTRA_DIST
+=
tools/mk_cfgrpt.sh
EXTRA_DIST
+=
tools/mk_cfgrpt.sh
#### include external sources in the distributed tarball:
EXTRA_DIST
+=
ext/coroutine/coroutine.h
pkgconfigdir
=
$(libdir)
/pkgconfig
pkgconfigdir
=
$(libdir)
/pkgconfig
pkgconfig_DATA
=
dns++.pc
pkgconfig_DATA
=
dns++.pc
...
...
configure.ac
View file @
3b4db076
...
@@ -1000,9 +1000,6 @@ fi
...
@@ -1000,9 +1000,6 @@ fi
#
#
# ASIO: we extensively use it as the C++ event management module.
# ASIO: we extensively use it as the C++ event management module.
#
#
# Use our 'coroutine' header from ext
CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/ext/coroutine"
#
# Doesn't seem to be required?
# Doesn't seem to be required?
CPPFLAGS="$CPPFLAGS -DBOOST_ASIO_HEADER_ONLY"
CPPFLAGS="$CPPFLAGS -DBOOST_ASIO_HEADER_ONLY"
#
#
...
@@ -1190,7 +1187,6 @@ AC_CONFIG_FILES([Makefile
...
@@ -1190,7 +1187,6 @@ AC_CONFIG_FILES([Makefile
doc/guide/Makefile
doc/guide/Makefile
doc/version.ent
doc/version.ent
ext/Makefile
ext/Makefile
ext/coroutine/Makefile
ext/gtest/Makefile
ext/gtest/Makefile
m4macros/Makefile
m4macros/Makefile
src/Makefile
src/Makefile
...
...
ext/Makefile.am
View file @
3b4db076
SUBDIRS
=
coroutine
SUBDIRS
=
.
if
HAVE_GTEST_SOURCE
if
HAVE_GTEST_SOURCE
SUBDIRS
+=
gtest
SUBDIRS
+=
gtest
...
...
ext/coroutine/LICENSE_1_0.txt
deleted
100644 → 0
View file @
7feedc09
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
ext/coroutine/Makefile.am
deleted
100644 → 0
View file @
7feedc09
EXTRA_DIST
=
LICENSE_1_0.txt
ext/coroutine/coroutine.h
deleted
100644 → 0
View file @
7feedc09
//
// coroutine.h
// ~~~~~~~~~~~
//
// Copyright (c) 2003-2010 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef COROUTINE_HPP
#define COROUTINE_HPP
// \brief Coroutine object
//
// A coroutine object maintains the state of a re-enterable routine. It
// is assignable and copy-constructible, and can be used as a base class
// for a class that uses it, or as a data member. The copy overhead is
// a single int.
//
// A reentrant function contains a CORO_REENTER (coroutine) { ... }
// block. Whenever an asynchronous operation is initiated within the
// routine, the function is provided as the handler object. (The simplest
// way to do this is to have the reentrant function be the operator()
// member for the coroutine object itself.) For example:
//
// CORO_YIELD socket->async_read_some(buffer, *this);
//
// The CORO_YIELD keyword updates the current status of the coroutine to
// indicate the line number currently being executed. The
// async_read_some() call is initiated, with a copy of the updated
// coroutine as its handler object, and the current coroutine exits. When
// the async_read_some() call finishes, the copied coroutine will be
// called, and will resume processing exactly where the original one left
// off--right after asynchronous call. This allows asynchronous I/O
// routines to be written with a logical flow, step following step, rather
// than as a linked chain of separate handler functions.
//
// When necessary, a coroutine can fork itself using the CORO_FORK keyword.
// This updates the status of the coroutine and makes a copy. The copy can
// then be called directly or posted to the ASIO service queue so that both
// coroutines will continue forward, one "parent" and one "child". The
// is_parent() and is_child() methods indicate which is which.
//
// The CORO_REENTER, CORO_YIELD and CORO_FORK keywords are implemented
// via preprocessor macros. The CORO_REENTER block is actually a large,
// complex switch statement. Because of this, inline variable declaration
// is impossible within CORO_REENTER unless it is done in a subsidiary
// scope--and if it is, that scope cannot contain CORO_YIELD or CORO_FORK
// keywords.
//
// Because coroutines are frequently copied, it is best to minimize copy
// overhead by limiting the size of data members in derived classes.
//
// It should be noted that when a coroutine falls out of scope its memory
// is reclaimed, even though it may be scheduled to resume when an
// asynchronous operation completes. Any shared_ptr<> objects declared in
// the coroutine may be destroyed if their reference count drops to zero,
// in which case the coroutine will have serious problems once it resumes.
// One solution so this is to have the space that will be used by a
// coroutine pre-allocated and stored on a free list; a new coroutine can
// fetch the block of space off a free list, place a shared pointer to it
// on an "in use" list, and carry on. The reference in the "in use" list
// would prevent the data from being destroyed.
class
coroutine
{
public:
coroutine
()
:
value_
(
0
)
{}
virtual
~
coroutine
()
{}
bool
is_child
()
const
{
return
value_
<
0
;
}
bool
is_parent
()
const
{
return
!
is_child
();
}
bool
is_complete
()
const
{
return
value_
==
-
1
;
}
int
get_value
()
const
{
return
value_
;
}
private:
friend
class
coroutine_ref
;
int
value_
;
};
class
coroutine_ref
{
public:
coroutine_ref
(
coroutine
&
c
)
:
value_
(
c
.
value_
),
modified_
(
false
)
{}
coroutine_ref
(
coroutine
*
c
)
:
value_
(
c
->
value_
),
modified_
(
false
)
{}
~
coroutine_ref
()
{
if
(
!
modified_
)
value_
=
-
1
;
}
operator
int
()
const
{
return
value_
;
}
int
&
operator
=
(
int
v
)
{
modified_
=
true
;
return
value_
=
v
;
}
private:
void
operator
=
(
const
coroutine_ref
&
);
int
&
value_
;
bool
modified_
;
};
#define CORO_REENTER(c) \
switch (coroutine_ref _coro_value = c) \
case -1: if (_coro_value) \
{ \
goto terminate_coroutine; \
terminate_coroutine: \
_coro_value = -1; \
goto bail_out_of_coroutine; \
bail_out_of_coroutine: \
break; \
} \
else case 0:
#define CORO_YIELD \
for (_coro_value = __LINE__;;) \
if (_coro_value == 0) \
{ \
case __LINE__: ; \
break; \
} \
else \
switch (_coro_value ? 0 : 1) \
for (;;) \
case -1: if (_coro_value) \
goto terminate_coroutine; \
else for (;;) \
case 1: if (_coro_value) \
goto bail_out_of_coroutine; \
else case 0:
#define CORO_FORK \
for (_coro_value = -__LINE__;; _coro_value = __LINE__) \
if (_coro_value == __LINE__) \
{ \
case -__LINE__: ; \
break; \
} \
else
#endif // COROUTINE_HPP
m4macros/ax_boost_for_kea.m4
View file @
3b4db076
...
@@ -74,7 +74,7 @@ if test "${boost_include_path}" ; then
...
@@ -74,7 +74,7 @@ if test "${boost_include_path}" ; then
BOOST_INCLUDES="-I${boost_include_path}"
BOOST_INCLUDES="-I${boost_include_path}"
CPPFLAGS="$CPPFLAGS $BOOST_INCLUDES"
CPPFLAGS="$CPPFLAGS $BOOST_INCLUDES"
fi
fi
AC_CHECK_HEADERS([boost/shared_ptr.hpp boost/foreach.hpp boost/interprocess/sync/interprocess_upgradable_mutex.hpp boost/date_time/posix_time/posix_time_types.hpp boost/bind.hpp boost/function.hpp boost/asio.hpp boost/asio/ip/address.hpp boost/system/error_code.hpp],,
AC_CHECK_HEADERS([boost/shared_ptr.hpp boost/foreach.hpp boost/interprocess/sync/interprocess_upgradable_mutex.hpp boost/date_time/posix_time/posix_time_types.hpp boost/bind.hpp boost/function.hpp boost/asio
/coroutine.hpp boost/asio
.hpp boost/asio/ip/address.hpp boost/system/error_code.hpp],,
AC_MSG_ERROR([Missing required header files.]))
AC_MSG_ERROR([Missing required header files.]))
# clang can cause false positives with -Werror without -Qunused-arguments.
# clang can cause false positives with -Werror without -Qunused-arguments.
...
...
src/bin/agent/agent_lexer.ll
View file @
3b4db076
...
@@ -423,6 +423,7 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
...
@@ -423,6 +423,7 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
case '"
':
case '"
':
/
*
impossible
condition
*
/
/
*
impossible
condition
*
/
driver
.
error
(
driver
.
loc_
,
"Bad quote in \"" + raw + "
\
""
)
;
driver
.
error
(
driver
.
loc_
,
"Bad quote in \"" + raw + "
\
""
)
;
break
;
case
'\\':
case
'\\':
++pos
;
++pos
;
if
(
pos
>=
len
)
{
if
(
pos
>=
len
)
{
...
...
src/bin/d2/d2_lexer.ll
View file @
3b4db076
...
@@ -497,6 +497,7 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
...
@@ -497,6 +497,7 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
case '"
':
case '"
':
/
*
impossible
condition
*
/
/
*
impossible
condition
*
/
driver
.
error
(
driver
.
loc_
,
"Bad quote in \"" + raw + "
\
""
)
;
driver
.
error
(
driver
.
loc_
,
"Bad quote in \"" + raw + "
\
""
)
;
break
;
case
'\\':
case
'\\':
++pos
;
++pos
;
if
(
pos
>=
len
)
{
if
(
pos
>=
len
)
{
...
...
src/bin/dhcp4/dhcp4_lexer.ll
View file @
3b4db076
...
@@ -1424,6 +1424,7 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
...
@@ -1424,6 +1424,7 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
case '"
':
case '"
':
/
*
impossible
condition
*
/
/
*
impossible
condition
*
/
driver
.
error
(
driver
.
loc_
,
"Bad quote in \"" + raw + "
\
""
)
;
driver
.
error
(
driver
.
loc_
,
"Bad quote in \"" + raw + "
\
""
)
;
break
;
case
'\\':
case
'\\':
++pos
;
++pos
;
if
(
pos
>=
len
)
{
if
(
pos
>=
len
)
{
...
...
src/bin/dhcp6/dhcp6_lexer.ll
View file @
3b4db076
...
@@ -1445,6 +1445,7 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
...
@@ -1445,6 +1445,7 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
case '"
':
case '"
':
/
*
impossible
condition
*
/
/
*
impossible
condition
*
/
driver
.
error
(
driver
.
loc_
,
"Bad quote in \"" + raw + "
\
""
)
;
driver
.
error
(
driver
.
loc_
,
"Bad quote in \"" + raw + "
\
""
)
;
break
;
case
'\\':
case
'\\':
++pos
;
++pos
;
if
(
pos
>=
len
)
{
if
(
pos
>=
len
)
{
...
...
src/lib/asiodns/io_fetch.cc
View file @
3b4db076
...
@@ -225,7 +225,7 @@ IOFetch::getProtocol() const {
...
@@ -225,7 +225,7 @@ IOFetch::getProtocol() const {
}
}
/// The function operator is implemented with the "stackless coroutine"
/// The function operator is implemented with the "stackless coroutine"
/// pattern; see
internal/coroutine.h
for details.
/// pattern; see
boost/asio/coroutine.hpp
for details.
void
void
IOFetch
::
operator
()(
boost
::
system
::
error_code
ec
,
size_t
length
)
{
IOFetch
::
operator
()(
boost
::
system
::
error_code
ec
,
size_t
length
)
{
...
@@ -241,7 +241,7 @@ IOFetch::operator()(boost::system::error_code ec, size_t length) {
...
@@ -241,7 +241,7 @@ IOFetch::operator()(boost::system::error_code ec, size_t length) {
return
;
return
;
}
}
CORO_REENTER
(
this
)
{
BOOST_ASIO_
CORO_REENTER
(
this
)
{
/// Generate the upstream query and render it to wire format
/// Generate the upstream query and render it to wire format
/// This is done in a different scope to allow inline variable
/// This is done in a different scope to allow inline variable
...
@@ -270,14 +270,14 @@ IOFetch::operator()(boost::system::error_code ec, size_t length) {
...
@@ -270,14 +270,14 @@ IOFetch::operator()(boost::system::error_code ec, size_t length) {
if
(
data_
->
socket
->
isOpenSynchronous
())
{
if
(
data_
->
socket
->
isOpenSynchronous
())
{
data_
->
socket
->
open
(
data_
->
remote_snd
.
get
(),
*
this
);
data_
->
socket
->
open
(
data_
->
remote_snd
.
get
(),
*
this
);
}
else
{
}
else
{
CORO_YIELD
data_
->
socket
->
open
(
data_
->
remote_snd
.
get
(),
*
this
);
BOOST_ASIO_
CORO_YIELD
data_
->
socket
->
open
(
data_
->
remote_snd
.
get
(),
*
this
);
}
}
do
{
do
{
// Begin an asynchronous send, and then yield. When the send completes,
// Begin an asynchronous send, and then yield. When the send completes,
// we will resume immediately after this point.
// we will resume immediately after this point.
data_
->
origin
=
ASIODNS_SEND_DATA
;
data_
->
origin
=
ASIODNS_SEND_DATA
;
CORO_YIELD
data_
->
socket
->
asyncSend
(
data_
->
msgbuf
->
getData
(),
BOOST_ASIO_
CORO_YIELD
data_
->
socket
->
asyncSend
(
data_
->
msgbuf
->
getData
(),
data_
->
msgbuf
->
getLength
(),
data_
->
remote_snd
.
get
(),
*
this
);
data_
->
msgbuf
->
getLength
(),
data_
->
remote_snd
.
get
(),
*
this
);
// Now receive the response. Since TCP may not receive the entire
// Now receive the response. Since TCP may not receive the entire
...
@@ -304,13 +304,13 @@ IOFetch::operator()(boost::system::error_code ec, size_t length) {
...
@@ -304,13 +304,13 @@ IOFetch::operator()(boost::system::error_code ec, size_t length) {
data_
->
offset
=
0
;
// First data into start of buffer
data_
->
offset
=
0
;
// First data into start of buffer
data_
->
received
->
clear
();
// Clear the receive buffer
data_
->
received
->
clear
();
// Clear the receive buffer
do
{
do
{
CORO_YIELD
data_
->
socket
->
asyncReceive
(
data_
->
staging
,
BOOST_ASIO_
CORO_YIELD
data_
->
socket
->
asyncReceive
(
data_
->
staging
,
static_cast
<
size_t
>
(
STAGING_LENGTH
),
static_cast
<
size_t
>
(
STAGING_LENGTH
),
data_
->
offset
,
data_
->
offset
,
data_
->
remote_rcv
.
get
(),
*
this
);
data_
->
remote_rcv
.
get
(),
*
this
);
}
while
(
!
data_
->
socket
->
processReceivedData
(
data_
->
staging
,
length
,
}
while
(
!
data_
->
socket
->
processReceivedData
(
data_
->
staging
,
length
,
data_
->
cumulative
,
data_
->
offset
,
data_
->
cumulative
,
data_
->
offset
,
data_
->
expected
,
data_
->
received
));
data_
->
expected
,
data_
->
received
));
}
while
(
!
data_
->
responseOK
());
}
while
(
!
data_
->
responseOK
());
// Finished with this socket, so close it. This will not generate an
// Finished with this socket, so close it. This will not generate an
...
...
src/lib/asiodns/io_fetch.h
View file @
3b4db076
// Copyright (C) 2010-201
5
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2010-201
7
Internet Systems Consortium, Inc. ("ISC")
//
//
// This Source Code Form is subject to the terms of the Mozilla Public
// 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
// License, v. 2.0. If a copy of the MPL was not distributed with this
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <
coroutine.h
>
#include <
boost/asio/coroutine.hpp
>
#include <boost/system/error_code.hpp>
#include <boost/system/error_code.hpp>
#include <asiolink/io_address.h>
#include <asiolink/io_address.h>
...
@@ -33,7 +33,7 @@ struct IOFetchData;
...
@@ -33,7 +33,7 @@ struct IOFetchData;
///
///
/// \param E Endpoint type to use.
/// \param E Endpoint type to use.
class
IOFetch
:
public
coroutine
{
class
IOFetch
:
public
boost
::
asio
::
coroutine
{
public:
public:
/// \brief Protocol to use on the fetch
/// \brief Protocol to use on the fetch
enum
Protocol
{
enum
Protocol
{
...
...
src/lib/asiolink/io_asio_socket.h
View file @
3b4db076
...
@@ -16,13 +16,14 @@
...
@@ -16,13 +16,14 @@
#include <string>
#include <string>
#include <exceptions/exceptions.h>
#include <exceptions/exceptions.h>
#include <coroutine.h>
#include <util/buffer.h>
#include <util/buffer.h>
#include <asiolink/io_error.h>
#include <asiolink/io_error.h>
#include <asiolink/io_socket.h>
#include <asiolink/io_socket.h>
#include <boost/asio/coroutine.hpp>
namespace
isc
{
namespace
isc
{
namespace
asiolink
{
namespace
asiolink
{
...
...
src/lib/cc/data.cc
View file @
3b4db076
...
@@ -342,7 +342,7 @@ skipTo(std::istream& in, const std::string& file, int& line,
...
@@ -342,7 +342,7 @@ skipTo(std::istream& in, const std::string& file, int& line,
// error on the rest)?
// error on the rest)?
std
::
string
std
::
string
strFromStringstream
(
std
::
istream
&
in
,
const
std
::
string
&
file
,
strFromStringstream
(
std
::
istream
&
in
,
const
std
::
string
&
file
,
const
int
line
,
int
&
pos
)
throw
(
JSONError
)
const
int
line
,
int
&
pos
)
{
{
std
::
stringstream
ss
;
std
::
stringstream
ss
;
int
c
=
in
.
get
();
int
c
=
in
.
get
();
...
@@ -608,7 +608,7 @@ Element::nameToType(const std::string& type_name) {
...
@@ -608,7 +608,7 @@ Element::nameToType(const std::string& type_name) {
}
}
ElementPtr
ElementPtr
Element
::
fromJSON
(
std
::
istream
&
in
,
bool
preproc
)
throw
(
JSONError
)
{
Element
::
fromJSON
(
std
::
istream
&
in
,
bool
preproc
)
{
int
line
=
1
,
pos
=
1
;
int
line
=
1
,
pos
=
1
;
stringstream
filtered
;
stringstream
filtered
;
...
@@ -623,7 +623,6 @@ Element::fromJSON(std::istream& in, bool preproc) throw(JSONError) {
...
@@ -623,7 +623,6 @@ Element::fromJSON(std::istream& in, bool preproc) throw(JSONError) {
ElementPtr
ElementPtr
Element
::
fromJSON
(
std
::
istream
&
in
,
const
std
::
string
&
file_name
,
bool
preproc
)
Element
::
fromJSON
(
std
::
istream
&
in
,
const
std
::
string
&
file_name
,
bool
preproc
)
throw
(
JSONError
)
{
{
int
line
=
1
,
pos
=
1
;
int
line
=
1
,
pos
=
1
;
stringstream
filtered
;
stringstream
filtered
;
...
@@ -635,7 +634,7 @@ Element::fromJSON(std::istream& in, const std::string& file_name, bool preproc)
...
@@ -635,7 +634,7 @@ Element::fromJSON(std::istream& in, const std::string& file_name, bool preproc)
ElementPtr
ElementPtr
Element
::
fromJSON
(
std
::
istream
&
in
,
const
std
::
string
&
file
,
int
&
line
,
Element
::
fromJSON
(
std
::
istream
&
in
,
const
std
::
string
&
file
,
int
&
line
,
int
&
pos
)
throw
(
JSONError
)
int
&
pos
)
{
{
int
c
=
0
;
int
c
=
0
;
ElementPtr
element
;
ElementPtr
element
;
...
...
src/lib/cc/data.h
View file @
3b4db076
...
@@ -427,8 +427,8 @@ public:
...
@@ -427,8 +427,8 @@ public:
/// should be performed
/// should be performed
/// @return An ElementPtr that contains the element(s) specified
/// @return An ElementPtr that contains the element(s) specified
/// in the given input stream.
/// in the given input stream.
static
ElementPtr
fromJSON
(
std
::
istream
&
in
,
bool
preproc
=
false
)
/// @throw JSONError
throw
(
JSONError
);
static
ElementPtr
fromJSON
(
std
::
istream
&
in
,
bool
preproc
=
false
);
/// Creates an Element from the given input stream containing JSON
/// Creates an Element from the given input stream containing JSON
/// formatted data.
/// formatted data.
...
@@ -439,9 +439,9 @@ public:
...
@@ -439,9 +439,9 @@ public:
/// should be performed
/// should be performed
/// @return An ElementPtr that contains the element(s) specified
/// @return An ElementPtr that contains the element(s) specified
/// in the given input stream.
/// in the given input stream.
/// @throw JSONError
static
ElementPtr
fromJSON
(
std
::
istream
&
in
,
const
std
::
string
&
file_name
,
static
ElementPtr
fromJSON
(
std
::
istream
&
in
,
const
std
::
string
&
file_name
,
bool
preproc
=
false
)
bool
preproc
=
false
);
throw
(
JSONError
);
/// Creates an Element from the given input stream, where we keep
/// Creates an Element from the given input stream, where we keep
/// track of the location in the stream for error reporting.
/// track of the location in the stream for error reporting.
...
@@ -455,9 +455,9 @@ public:
...
@@ -455,9 +455,9 @@ public:
/// @return An ElementPtr that contains the element(s) specified
/// @return An ElementPtr that contains the element(s) specified
/// in the given input stream.
/// in the given input stream.
// make this one private?
// make this one private?
/// @throw JSONError
static
ElementPtr
fromJSON
(
std
::
istream
&
in
,
const
std
::
string
&
file
,
static
ElementPtr
fromJSON
(
std
::
istream
&
in
,
const
std
::
string
&
file
,
int
&
line
,
int
&
pos
)
int
&
line
,
int
&
pos
);
throw
(
JSONError
);
/// Reads contents of specified file and interprets it as JSON.
/// Reads contents of specified file and interprets it as JSON.
///
///
...
@@ -741,7 +741,7 @@ void merge(ElementPtr element, ConstElementPtr other);
...
@@ -741,7 +741,7 @@ void merge(ElementPtr element, ConstElementPtr other);
/// @param level nesting level (default is 100, 0 means shallow copy,
/// @param level nesting level (default is 100, 0 means shallow copy,
/// negative means outbound and perhaps looping forever).
/// negative means outbound and perhaps looping forever).
/// @return a pointer to a fresh copy
/// @return a pointer to a fresh copy
///
\
throw raises a BadValue is a null pointer occurs.
///
@
throw raises a BadValue is a null pointer occurs.
ElementPtr
copy
(
ConstElementPtr
from
,
int
level
=
100
);
ElementPtr
copy
(
ConstElementPtr
from
,
int
level
=
100
);
/// @brief Compares the data with other using unordered lists
/// @brief Compares the data with other using unordered lists
...
...
src/lib/cc/json_feed.cc
View file @
3b4db076
...
@@ -210,7 +210,7 @@ void
...
@@ -210,7 +210,7 @@ void
JSONFeed
::
receiveStartHandler
()
{
JSONFeed
::
receiveStartHandler
()
{
char
c
=
getNextFromBuffer
();
char
c
=
getNextFromBuffer
();
if
(
getNextEvent
()
!=
NEED_MORE_DATA_EVT
)
{
if
(
getNextEvent
()
!=
NEED_MORE_DATA_EVT
)
{
switch
(
getNextEvent
())
{
switch
(
getNextEvent
())
{
case
START_EVT
:
case
START_EVT
:
switch
(
c
)
{
switch
(
c
)
{
case
'\t'
:
case
'\t'
:
...
@@ -229,6 +229,7 @@ JSONFeed::receiveStartHandler() {
...
@@ -229,6 +229,7 @@ JSONFeed::receiveStartHandler() {
default:
default:
feedFailure
(
"invalid first character "
+
std
::
string
(
1
,
c
));
feedFailure
(
"invalid first character "
+
std
::
string
(
1
,
c
));
break
;
}
}
default:
default:
...
...
src/lib/config/module_spec.cc
View file @
3b4db076
// Copyright (C) 2010-201
5
Internet Systems Consortium.
// Copyright (C) 2010-201
7
Internet Systems Consortium.
//
//
// This Source Code Form is subject to the terms of the Mozilla Public
// 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
// License, v. 2.0. If a copy of the MPL was not distributed with this
...
@@ -186,9 +186,9 @@ namespace config {
...
@@ -186,9 +186,9 @@ namespace config {
// Public functions
// Public functions
//
//
// throw ModuleSpecError
ModuleSpec
::
ModuleSpec
(
ConstElementPtr
module_spec_element
,
ModuleSpec
::
ModuleSpec
(
ConstElementPtr
module_spec_element
,
const
bool
check
)
const
bool
check
)
throw
(
ModuleSpecError
)
{
{
module_specification
=
module_spec_element
;
module_specification
=
module_spec_element
;
...
@@ -296,9 +296,9 @@ ModuleSpec::validateStatistics(ConstElementPtr data, const bool full,
...
@@ -296,9 +296,9 @@ ModuleSpec::validateStatistics(ConstElementPtr data, const bool full,
return
(
validateSpecList
(
spec
,
data
,
full
,
errors
));
return
(
validateSpecList
(
spec
,
data
,
full
,
errors
));
}
}
// throw JSONError and ModuleSpecError
ModuleSpec
ModuleSpec
moduleSpecFromFile
(
const
std
::
string
&
file_name
,
const
bool
check
)
moduleSpecFromFile
(
const
std
::
string
&
file_name
,
const
bool
check
)
throw
(
JSONError
,
ModuleSpecError
)
{
{
std
::
ifstream
file
;
std
::
ifstream
file
;
...
@@ -320,9 +320,9 @@ moduleSpecFromFile(const std::string& file_name, const bool check)
...
@@ -320,9 +320,9 @@ moduleSpecFromFile(const std::string& file_name, const bool check)
}
}
}
}
// throw JSONError and ModuleSpecError
ModuleSpec
ModuleSpec
moduleSpecFromFile
(
std
::
ifstream
&
in
,
const
bool