XenevaOS
Loading...
Searching...
No Matches
Macros | Functions | Variables
main.cpp File Reference
#include <stdint.h>
#include <_xeneva.h>
#include <stdio.h>
#include <sys\_keproc.h>
#include <sys\_kefile.h>
#include <sys\iocodes.h>
#include <string.h>
#include <stdlib.h>
#include <sys\socket.h>
Include dependency graph for main.cpp:

Macros

#define htonl(l)   ((((l) & 0xFF) << 24) | (((l) & 0xFF00) << 8) | (((l) & 0xFF0000) >> 8) | (((l) & 0xFF000000) >> 24))
 
#define htons(s)   ((((s) & 0xFF) << 8) | (((s) & 0xFF00) >> 8))
 
#define ntohl(l)   htonl((l))
 
#define ntohs(s)   htons((s))
 
#define IPV4_PROT_UDP   17
 
#define DHCP_MAGIC   0x63825363
 

Functions

 __declspec (align(2)) typedef struct _ethernet_
 
 _declspec (align(2)) typedef struct _dhcp_pack_
 
uint16_t calculate_ipv4_checksum (IPV4 *p)
 
EthernetfillDHCP (uint8_t *payload, size_t payload_sz)
 
void ClearDHCP (Ethernet *eth)
 
ssize_t socket_receive (int sockfd, void *buf, size_t len, int flags)
 
ssize_t socket_send (int sockfd, const void *buf, size_t len, int flags)
 
ssize_t socket_sendto (int sockfd, const void *buf, size_t len, int flags, sockaddr *dest_addr, socklen_t addrlen)
 
void ip_ntoa (uint32_t src_addr, char *out)
 
int main (int argc, char *argv[])
 

Variables

 Ethernet
 
 IPV4
 
 UDPPack
 
 DHCPPack
 
uint32_t xid = 0x1337
 
uint8_t mac [6]
 

Macro Definition Documentation

◆ DHCP_MAGIC

#define DHCP_MAGIC   0x63825363

◆ htonl

#define htonl (   l)    ((((l) & 0xFF) << 24) | (((l) & 0xFF00) << 8) | (((l) & 0xFF0000) >> 8) | (((l) & 0xFF000000) >> 24))

BSD 2-Clause License

Copyright (c) 2023-2024, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

◆ htons

#define htons (   s)    ((((s) & 0xFF) << 8) | (((s) & 0xFF00) >> 8))

◆ IPV4_PROT_UDP

#define IPV4_PROT_UDP   17

◆ ntohl

#define ntohl (   l)    htonl((l))

◆ ntohs

#define ntohs (   s)    htons((s))

Function Documentation

◆ __declspec()

__declspec ( align(2)  )

◆ _declspec()

_declspec ( align(2)  )

◆ calculate_ipv4_checksum()

uint16_t calculate_ipv4_checksum ( IPV4 p)

◆ ClearDHCP()

void ClearDHCP ( Ethernet eth)

◆ fillDHCP()

Ethernet * fillDHCP ( uint8_t payload,
size_t  payload_sz 
)

◆ ip_ntoa()

void ip_ntoa ( uint32_t  src_addr,
char *  out 
)

◆ main()

int main ( int  argc,
char *  argv[] 
)

◆ socket_receive()

ssize_t socket_receive ( int  sockfd,
void *  buf,
size_t  len,
int  flags 
)

◆ socket_send()

ssize_t socket_send ( int  sockfd,
const void *  buf,
size_t  len,
int  flags 
)

◆ socket_sendto()

ssize_t socket_sendto ( int  sockfd,
const void *  buf,
size_t  len,
int  flags,
sockaddr dest_addr,
socklen_t  addrlen 
)

Variable Documentation

◆ DHCPPack

DHCPPack

◆ Ethernet

Ethernet

◆ IPV4

IPV4

◆ mac

uint8_t mac[6]

◆ UDPPack

UDPPack

◆ xid

uint32_t xid = 0x1337