Refactored directory structure

This commit is contained in:
scientiist
2023-04-29 13:20:33 -05:00
parent 8927679628
commit 9479926f8e
17 changed files with 22 additions and 58 deletions

View File

@@ -1,8 +0,0 @@
//
// Created by josh on 4/20/23.
//
#ifndef SOCKETS_HTTPHEADERS_HPP
#define SOCKETS_HTTPHEADERS_HPP
#endif //SOCKETS_HTTPHEADERS_HPP

View File

@@ -0,0 +1 @@
#pragma once

View File

@@ -0,0 +1 @@
#pragma once

View File

@@ -9,7 +9,7 @@
#include <sys/socket.h>
#include <unistd.h>
#include "Exceptions.hpp"
#include <Sockets/Exceptions.hpp>
namespace Socket
{

View File

@@ -10,7 +10,7 @@
#include <sys/socket.h>
#include <unistd.h>
#include <IPAddress.hpp>
#include <Sockets/IPAddress.hpp>
#ifndef INPORT_ANY
#define INPORT_ANY

View File

@@ -1,6 +1,6 @@
#pragma once
#include <IPAddress.hpp>
#include <Sockets/IPAddress.hpp>
#ifndef INPORT_ANY
#define INPORT_ANY 0
@@ -23,25 +23,13 @@ namespace Socket
void Open();
int Close();
bool IsClosed() const { return sock < 0;}
<<<<<<< Updated upstream
void Bind(const IPAddress& ipAddress);
void Bind(uint16_t portno);
void BindAny();
void BindAny(uint16_t& portno);
void Connect(const IPAddress& ipaddr);
void Connect(uint16_t portno);
=======
void Bind(const IPAddress& ipaddr);
void Bind(uint16_t portno);
void BindAny();
void BindAny(uint16_t& portno);
void Connect(const IPAddress& ipaddr);
void Connect(uint16_t portno);
<<<<<<< Updated upstream
>>>>>>> Stashed changes
=======
>>>>>>> Stashed changes
[[nodiscard]] IPAddress GetSelfIP() const {return self_addr;}
[[nodiscard]] IPAddress GetPeerIP() const {return peer_addr;}
public:

View File

@@ -1,6 +1,7 @@
#pragma once
#include <string>
#include <Sockets/IPAddress.hpp>
namespace Socket
{
@@ -12,6 +13,7 @@ namespace Socket
std::string const& GetUser() const { return user_;}
std::string const& GetHost() const { return host_;}
uint16_t GetPort() const { return port_;}
IPAddress GetIPAddress() const;
private:
std::string user_;
std::string host_;
@@ -33,6 +35,9 @@ namespace Socket
void SchemeIs(std::string const& scheme);
void AuthorityIs(std::string const& authority);
private:
std::string scheme_;
Auth authority_;
std::string path_;
};
}

View File

@@ -1,4 +1,4 @@
#include "include/TcpSocket.hpp"
#include "Sockets/TcpSocket.hpp"
#include <iostream>
#include <exception>

View File

@@ -1,4 +1,4 @@
#include "IPAddress.hpp"
#include "Sockets/IPAddress.hpp"
namespace Socket
{

View File

@@ -1,5 +1,5 @@
#include "Exceptions.hpp"
#include "TcpSocket.hpp"
#include "Sockets/Exceptions.hpp"
#include "Sockets/TcpSocket.hpp"
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>

View File

@@ -1,4 +1,4 @@
#include "UdpSocket.hpp"
#include "Sockets/UdpSocket.hpp"
namespace Socket
{
@@ -36,15 +36,8 @@ namespace Socket
return 0;
}
<<<<<<< Updated upstream
<<<<<<< Updated upstream
void UdpSocket::Bind(const IPAddress& ipAddress)
=======
void UdpSocket::Bind(IPAddress& ipaddr)
>>>>>>> Stashed changes
=======
void UdpSocket::Bind(IPAddress& ipaddr)
>>>>>>> Stashed changes
{
self_addr = ipAddress;
self_addr_len = sizeof(self_addr);
@@ -74,20 +67,10 @@ namespace Socket
}
void UdpSocket::BindAny(uint16_t& portno)
{
<<<<<<< Updated upstream
<<<<<<< Updated upstream
this->Bind(INPORT_ANY);
portno = IPAddress{self_addr}.port;
=======
this->Bind(INPORT_ANY);
portno = IPAddress{self_addr}.port;
//return 0;
>>>>>>> Stashed changes
=======
this->Bind(INPORT_ANY);
portno = IPAddress{self_addr}.port;
//return 0;
>>>>>>> Stashed changes
}
void UdpSocket::Connect(const IPAddress& ipaddr)
{
@@ -101,15 +84,9 @@ namespace Socket
void UdpSocket::Connect(uint16_t portno)
{
auto ipaddr = IPAddress::Loopback(portno);
<<<<<<< Updated upstream
<<<<<<< Updated upstream
this->Connect(ipaddr);
=======
this->Connect(ipaddr);
>>>>>>> Stashed changes
=======
this->Connect(ipaddr);
>>>>>>> Stashed changes
}
template <typename T>