From bac3da61644515f05663789b122554dc77549286 Mon Sep 17 00:00:00 2001 From: Luca Muscariello Date: Thu, 17 Jan 2019 13:47:57 +0100 Subject: This is the first commit of the hicn project Change-Id: I6f2544ad9b9f8891c88cc4bcce3cf19bd3cc863f Signed-off-by: Luca Muscariello --- .../src/hicn/transport/errors/CMakeLists.txt | 29 ++++++++++++++++++++ libtransport/src/hicn/transport/errors/errors.h | 24 ++++++++++++++++ .../errors/invalid_ip_address_exception.h | 31 +++++++++++++++++++++ .../errors/malformed_ahpacket_exception.h | 31 +++++++++++++++++++++ .../transport/errors/malformed_name_exception.h | 31 +++++++++++++++++++++ .../transport/errors/malformed_packet_exception.h | 29 ++++++++++++++++++++ .../transport/errors/not_implemented_exception.h | 30 ++++++++++++++++++++ .../hicn/transport/errors/null_pointer_exception.h | 31 +++++++++++++++++++++ .../src/hicn/transport/errors/runtime_exception.h | 32 ++++++++++++++++++++++ .../hicn/transport/errors/tokenizer_exception.h | 31 +++++++++++++++++++++ 10 files changed, 299 insertions(+) create mode 100755 libtransport/src/hicn/transport/errors/CMakeLists.txt create mode 100755 libtransport/src/hicn/transport/errors/errors.h create mode 100755 libtransport/src/hicn/transport/errors/invalid_ip_address_exception.h create mode 100755 libtransport/src/hicn/transport/errors/malformed_ahpacket_exception.h create mode 100755 libtransport/src/hicn/transport/errors/malformed_name_exception.h create mode 100755 libtransport/src/hicn/transport/errors/malformed_packet_exception.h create mode 100755 libtransport/src/hicn/transport/errors/not_implemented_exception.h create mode 100755 libtransport/src/hicn/transport/errors/null_pointer_exception.h create mode 100755 libtransport/src/hicn/transport/errors/runtime_exception.h create mode 100755 libtransport/src/hicn/transport/errors/tokenizer_exception.h (limited to 'libtransport/src/hicn/transport/errors') diff --git a/libtransport/src/hicn/transport/errors/CMakeLists.txt b/libtransport/src/hicn/transport/errors/CMakeLists.txt new file mode 100755 index 000000000..1c19a9070 --- /dev/null +++ b/libtransport/src/hicn/transport/errors/CMakeLists.txt @@ -0,0 +1,29 @@ +# Copyright (c) 2017-2019 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cmake_minimum_required(VERSION 3.5 FATAL_ERROR) + +list(APPEND HEADER_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/not_implemented_exception.h + ${CMAKE_CURRENT_SOURCE_DIR}/invalid_ip_address_exception.h + ${CMAKE_CURRENT_SOURCE_DIR}/malformed_name_exception.h + ${CMAKE_CURRENT_SOURCE_DIR}/errors.h + ${CMAKE_CURRENT_SOURCE_DIR}/malformed_packet_exception.h + ${CMAKE_CURRENT_SOURCE_DIR}/runtime_exception.h + ${CMAKE_CURRENT_SOURCE_DIR}/tokenizer_exception.h + ${CMAKE_CURRENT_SOURCE_DIR}/null_pointer_exception.h + ${CMAKE_CURRENT_SOURCE_DIR}/malformed_ahpacket_exception.h +) + +set(SOURCE_FILES ${SOURCE_FILES} PARENT_SCOPE) +set(HEADER_FILES ${HEADER_FILES} PARENT_SCOPE) \ No newline at end of file diff --git a/libtransport/src/hicn/transport/errors/errors.h b/libtransport/src/hicn/transport/errors/errors.h new file mode 100755 index 000000000..512e35736 --- /dev/null +++ b/libtransport/src/hicn/transport/errors/errors.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2017-2019 Cisco and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include \ No newline at end of file diff --git a/libtransport/src/hicn/transport/errors/invalid_ip_address_exception.h b/libtransport/src/hicn/transport/errors/invalid_ip_address_exception.h new file mode 100755 index 000000000..60226f576 --- /dev/null +++ b/libtransport/src/hicn/transport/errors/invalid_ip_address_exception.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2017-2019 Cisco and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +namespace errors { + +class InvalidIpAddressException : public std::runtime_error { + public: + InvalidIpAddressException() : std::runtime_error("") {} + + virtual char const *what() const noexcept override { + return "Malformed IP address."; + } +}; + +} // end namespace errors \ No newline at end of file diff --git a/libtransport/src/hicn/transport/errors/malformed_ahpacket_exception.h b/libtransport/src/hicn/transport/errors/malformed_ahpacket_exception.h new file mode 100755 index 000000000..f0cfe0b82 --- /dev/null +++ b/libtransport/src/hicn/transport/errors/malformed_ahpacket_exception.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2017-2019 Cisco and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +namespace errors { + +class MalformedAHPacketException : public std::runtime_error { + public: + MalformedAHPacketException() : std::runtime_error("") {} + + virtual char const *what() const noexcept override { + return "Malformed AH packet."; + } +}; + +} // end namespace errors diff --git a/libtransport/src/hicn/transport/errors/malformed_name_exception.h b/libtransport/src/hicn/transport/errors/malformed_name_exception.h new file mode 100755 index 000000000..4ef45d2e8 --- /dev/null +++ b/libtransport/src/hicn/transport/errors/malformed_name_exception.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2017-2019 Cisco and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +namespace errors { + +class MalformedNameException : public std::runtime_error { + public: + MalformedNameException() : std::runtime_error("") {} + + virtual char const *what() const noexcept override { + return "Malformed IP address."; + } +}; + +} // end namespace errors diff --git a/libtransport/src/hicn/transport/errors/malformed_packet_exception.h b/libtransport/src/hicn/transport/errors/malformed_packet_exception.h new file mode 100755 index 000000000..ec5c97e6e --- /dev/null +++ b/libtransport/src/hicn/transport/errors/malformed_packet_exception.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2017-2019 Cisco and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +namespace errors { + +class MalformedPacketException : public std::runtime_error { + public: + MalformedPacketException() : std::runtime_error("") {} + + char const *what() const noexcept override { return "Malformed IP packet."; } +}; + +} // end namespace errors diff --git a/libtransport/src/hicn/transport/errors/not_implemented_exception.h b/libtransport/src/hicn/transport/errors/not_implemented_exception.h new file mode 100755 index 000000000..e9869163d --- /dev/null +++ b/libtransport/src/hicn/transport/errors/not_implemented_exception.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2017-2019 Cisco and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +namespace errors { + +class NotImplementedException : public std::logic_error { + public: + NotImplementedException() : std::logic_error("") {} + virtual char const *what() const noexcept override { + return "Function not yet implemented."; + } +}; + +} // end namespace errors diff --git a/libtransport/src/hicn/transport/errors/null_pointer_exception.h b/libtransport/src/hicn/transport/errors/null_pointer_exception.h new file mode 100755 index 000000000..bd06485ed --- /dev/null +++ b/libtransport/src/hicn/transport/errors/null_pointer_exception.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2017-2019 Cisco and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +namespace errors { + +class NullPointerException : public std::runtime_error { + public: + NullPointerException() : std::runtime_error("") {} + + char const *what() const noexcept override { + return "Null pointer exception."; + } +}; + +} // end namespace errors diff --git a/libtransport/src/hicn/transport/errors/runtime_exception.h b/libtransport/src/hicn/transport/errors/runtime_exception.h new file mode 100755 index 000000000..ba5128a7e --- /dev/null +++ b/libtransport/src/hicn/transport/errors/runtime_exception.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2017-2019 Cisco and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include +#include +#include + +namespace errors { + +class RuntimeException : public std::runtime_error { + public: + RuntimeException() : std::runtime_error("") {} + + RuntimeException(std::string what) : runtime_error(what){}; +}; + +} // end namespace errors \ No newline at end of file diff --git a/libtransport/src/hicn/transport/errors/tokenizer_exception.h b/libtransport/src/hicn/transport/errors/tokenizer_exception.h new file mode 100755 index 000000000..76eda838e --- /dev/null +++ b/libtransport/src/hicn/transport/errors/tokenizer_exception.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2017-2019 Cisco and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +namespace errors { + +class TokenizerException : public std::logic_error { + public: + TokenizerException() : std::logic_error("") {} + + virtual char const *what() const noexcept override { + return "No more tokens available."; + } +}; + +} // end namespace errors -- cgit 1.2.3-korg