Refactored directory structure
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
//
|
||||
// Created by josh on 4/20/23.
|
||||
//
|
||||
|
||||
#ifndef SOCKETS_HTTPHEADERS_HPP
|
||||
#define SOCKETS_HTTPHEADERS_HPP
|
||||
|
||||
#endif //SOCKETS_HTTPHEADERS_HPP
|
1
include/Sockets/HttpHeaders.hpp
Normal file
1
include/Sockets/HttpHeaders.hpp
Normal file
@@ -0,0 +1 @@
|
||||
#pragma once
|
1
include/Sockets/HttpResponse.hpp
Normal file
1
include/Sockets/HttpResponse.hpp
Normal file
@@ -0,0 +1 @@
|
||||
#pragma once
|
@@ -9,7 +9,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "Exceptions.hpp"
|
||||
#include <Sockets/Exceptions.hpp>
|
||||
|
||||
namespace Socket
|
||||
{
|
@@ -10,7 +10,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <IPAddress.hpp>
|
||||
#include <Sockets/IPAddress.hpp>
|
||||
|
||||
#ifndef INPORT_ANY
|
||||
#define INPORT_ANY
|
@@ -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:
|
@@ -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_;
|
||||
};
|
||||
}
|
2
main.cpp
2
main.cpp
@@ -1,4 +1,4 @@
|
||||
#include "include/TcpSocket.hpp"
|
||||
#include "Sockets/TcpSocket.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "IPAddress.hpp"
|
||||
#include "Sockets/IPAddress.hpp"
|
||||
|
||||
namespace Socket
|
||||
{
|
@@ -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>
|
@@ -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>
|
Reference in New Issue
Block a user