From 0cbfbe129934976359460fdbe69fb97632d81d24 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Fri, 15 Sep 2023 11:21:31 +0200 Subject: Added C++ (`ksocket/ksocket.hpp`) Socket wrapper classes. * another flatbuffers example (WiP!) * Makefile improvements Signed-off-by: Toni Uhlig --- ksocket/berkeley.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'ksocket/berkeley.h') diff --git a/ksocket/berkeley.h b/ksocket/berkeley.h index b879d3c..1475a89 100644 --- a/ksocket/berkeley.h +++ b/ksocket/berkeley.h @@ -1,6 +1,11 @@ -#pragma once +#ifndef KSOCKET_BERKELEY_H +#define KSOCKET_BERKELEY_H 1 + +#ifdef BUILD_USERMODE +#error "This file should only be included if building for kernel mode! Include wrapper instead." +#endif + #include -#include #include #define socket socket_connection @@ -12,11 +17,6 @@ extern "C" { typedef int socklen_t; typedef intptr_t ssize_t; -uint32_t htonl(uint32_t hostlong); -uint16_t htons(uint16_t hostshort); -uint32_t ntohl(uint32_t netlong); -uint16_t ntohs(uint16_t netshort); - int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res); void freeaddrinfo(struct addrinfo *res); @@ -39,3 +39,5 @@ int closesocket(int sockfd); #ifdef __cplusplus } #endif + +#endif -- cgit v1.2.3