Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix header includes. #32

Merged
merged 2 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/blackhole.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// SPDX-License-Identifier: LGPL-3.0-only
#include <cstring>
#include <climits>
#include <unistd.h>

#include <sys/stat.h>
#include <errno.h>
#include <cstring>
#include <climits>
#include <cstdlib>
#include <initializer_list>
#include <string>

#include "blackhole.hh"
#include "logging.hh"
Expand Down
1 change: 1 addition & 0 deletions src/dynports/dynports.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
#include <array>
#include <stdexcept>
#include <sys/types.h>
#include <unistd.h>
Expand Down
7 changes: 5 additions & 2 deletions src/globpath.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// SPDX-License-Identifier: LGPL-3.0-only
#include "globpath.hh"

#include <stddef.h>
#include <optional>
#include <string>
#include <string_view>

#include "globpath.hh"

enum class MatchResult {
Matched,
Expand Down
13 changes: 8 additions & 5 deletions src/ip2unix.cc
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
// SPDX-License-Identifier: LGPL-3.0-only
#include <getopt.h>
#include <unistd.h>
#include <dlfcn.h>
#include <errno.h>
#include <algorithm>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <getopt.h>
#include <string>
#include <unistd.h>
#include <dlfcn.h>
#include <cctype>
#include <fstream>
#include <optional>
#include <vector>

#include "rules.hh"
#include "serial.hh"
Expand Down
5 changes: 3 additions & 2 deletions src/logging.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: LGPL-3.0-only
#include <iostream>

#include <unistd.h>
#include <sys/stat.h>
#include <errno.h>
#include <stdlib.h>
#include <iostream>

#include "logging.hh"

Expand Down
1 change: 1 addition & 0 deletions src/logging.hh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <optional>
#include <sstream>
#include <string_view>

/* A small helper so that we always get the basename of the file at compile
* time instead of determining it at runtime.
Expand Down
22 changes: 14 additions & 8 deletions src/preload.cc
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
// SPDX-License-Identifier: LGPL-3.0-only
#include <queue>
#include <unordered_map>
#include <variant>
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <unistd.h>
#include <memory>
#include <mutex>

#include <arpa/inet.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <sys/un.h>
#include <functional>
#include <iostream>
#include <optional>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>

#ifndef WRAP_SYM
#define WRAP_SYM(x) ip2unix_wrap_##x
Expand All @@ -22,6 +27,7 @@
#include "socket.hh"
#include "logging.hh"
#include "serial.hh"
#include "sockaddr.hh"

#ifdef SYSTEMD_SUPPORT
#include "systemd.hh"
Expand Down
4 changes: 4 additions & 0 deletions src/realcalls.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// SPDX-License-Identifier: LGPL-3.0-only
#define IP2UNIX_REALCALL_EXTERN
#include <initializer_list>
#include <memory>
#include <mutex>

#include "realcalls.hh"

std::mutex g_dlsym_mutex;
Expand Down
8 changes: 5 additions & 3 deletions src/realcalls.hh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
#ifndef IP2UNIX_REALCALLS_HH
#define IP2UNIX_REALCALLS_HH

#include <cstring>
#include <mutex>

#include <unistd.h>
#include <dlfcn.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <cstring>
#include <mutex>

#include "logging.hh"

Expand Down
5 changes: 2 additions & 3 deletions src/rng.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: LGPL-3.0-only
#include <chrono>

#include <sys/types.h>
#include <unistd.h>
#include <stdint.h>
#include <chrono>

#include "rng.hh"

Expand Down
1 change: 1 addition & 0 deletions src/rng.hh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#define IP2UNIX_RANDOMIZER_HH

#include <random>
#include <algorithm>

extern std::default_random_engine __generator;

Expand Down
20 changes: 11 additions & 9 deletions src/rules/parse.cc
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
// SPDX-License-Identifier: LGPL-3.0-only
#include <algorithm>
#include <iostream>
#include <fstream>
#include <memory>
#include <sstream>
#include <unordered_map>

#include <arpa/inet.h>
#include <unistd.h>

#include <ctype.h>
#include <netinet/in.h>
#include <stdint.h>
#include <sys/socket.h>
#include <yaml-cpp/yaml.h>
#include <algorithm>
#include <iostream>
#include <cstddef>
#include <optional>
#include <string>
#include <vector>

#include "../rules.hh"

#include "errno_list.hh"
#include "types.hh"

static const std::string describe_nodetype(const YAML::Node &node)
{
Expand Down
3 changes: 3 additions & 0 deletions src/serial.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// SPDX-License-Identifier: LGPL-3.0-only
#include "serial.hh"
#include "rules.hh"
#include "systemd.hh"
#include "types.hh"

void serialise(const std::string &str, std::ostream &out)
{
Expand Down
13 changes: 13 additions & 0 deletions src/serial.hh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,25 @@
#ifndef IP2UNIX_SERIAL_HH
#define IP2UNIX_SERIAL_HH

#include <stdio.h>
#include <deque>
#include <sstream>
#include <unordered_map>
#include <optional>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>

#include "rules.hh"

enum class RuleDir;
enum class SocketType;
namespace Systemd {
struct FdInfo;
} // namespace Systemd
struct Rule;

#ifdef SYSTEMD_SUPPORT
#include "systemd.hh"
#endif
Expand Down
7 changes: 4 additions & 3 deletions src/sockaddr.cc
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// SPDX-License-Identifier: LGPL-3.0-only
#include <arpa/inet.h>
#include <netinet/in.h>
#include <cstring>
#include <stdexcept>
#include <optional>
#include <sstream>

#include <arpa/inet.h>
#include <algorithm>
#include <iterator>

#include "sockaddr.hh"
#include "rng.hh"
Expand Down
12 changes: 10 additions & 2 deletions src/sockaddr.hh
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
// SPDX-License-Identifier: LGPL-3.0-only
#ifndef IP2UNIX_SOCKETADDR_HH
#define IP2UNIX_SOCKETADDR_HH
#include <variant>

#include <netinet/in.h>
#include <sys/un.h>
#include <stdint.h>
#include <sys/socket.h>
#include <optional>
#include <string>
#include <variant>
#include <cstddef>
#include <utility>

struct sockaddr_in6;
struct sockaddr_in;

struct SockAddr : public sockaddr_storage
{
Expand Down
11 changes: 8 additions & 3 deletions src/socket.cc
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
// SPDX-License-Identifier: LGPL-3.0-only
#include <errno.h>
#include <stdint.h>
#include <unistd.h>
#include <cstring>
#include <fcntl.h>
#include <arpa/inet.h>
#include <sys/un.h>
#include <string>
#include <type_traits>
#include <utility>

#include "socket.hh"
#include "realcalls.hh"
#include "logging.hh"
#include "blackhole.hh"
#include "types.hh"

std::optional<Socket::Ptr> Socket::find(int fd)
{
Expand Down
5 changes: 5 additions & 0 deletions src/socket.hh
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@
#ifndef IP2UNIX_SOCKET_HH
#define IP2UNIX_SOCKET_HH

#include <sys/socket.h>
#include <functional>
#include <memory>
#include <mutex>
#include <optional>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#include "types.hh"
#include "sockaddr.hh"
#include "sockopts.hh"
#include "dynports.hh"
#include "blackhole.hh"

enum class SocketType;
struct BlackHole;

struct Socket : std::enable_shared_from_this<Socket>
{
using Ptr = std::shared_ptr<Socket>;
Expand Down
6 changes: 4 additions & 2 deletions src/sockopts.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// SPDX-License-Identifier: LGPL-3.0-only
#include <cstdio>
#include <cstring>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <asm/sockios.h>
#include <errno.h>
#include <cstdio>
#include <cstring>

#include "realcalls.hh"
#include "sockopts.hh"
Expand Down
7 changes: 5 additions & 2 deletions src/sockopts.hh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
#ifndef IP2UNIX_SOCKOPT_HH
#define IP2UNIX_SOCKOPT_HH

#include <arpa/inet.h>
#include <stdint.h>
#include <sys/socket.h>
#include <queue>
#include <variant>

#include <arpa/inet.h>
#include <optional>
#include <vector>

#ifdef HAS_EPOLL
#include <sys/epoll.h>
Expand Down
10 changes: 7 additions & 3 deletions src/systemd.cc
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
// SPDX-License-Identifier: LGPL-3.0-only
#include <fcntl.h>
#include <errno.h>
#include <sys/socket.h>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
#include <deque>

#include <fcntl.h>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <utility>

#include "rules.hh"
#include "systemd.hh"
#include "logging.hh"
#include "serial.hh"
#include "systemd.hh"

#define SD_LISTEN_FDS_START 3

Expand Down
6 changes: 6 additions & 0 deletions src/systemd.hh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
#ifndef IP2UNIX_SYSTEMD_HH
#define IP2UNIX_SYSTEMD_HH

#include <stddef.h>
#include <optional>
#include <vector>

#include "rules.hh"

struct Rule;

namespace Systemd {
struct FdInfo {
int fd;
Expand Down
7 changes: 3 additions & 4 deletions tests/helpers/accept_no_peer_addr.cc
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#include <cstdio>
#include <cstdlib>

#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <cstdio>
#include <cstdlib>

int main(void)
{
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/dynports.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include <stdint.h>
#include <string>
#include <stdexcept>
#include <unordered_set>

#include "dynports.hh"

Expand Down
Loading