XenevaOS
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
aunet.h File Reference
#include <stdint.h>
#include <aurora.h>
#include <Fs/vfs.h>
#include <Net/ipv6.h>
Include dependency graph for aunet.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _netdev_
 

Macros

#define NETDEV_TYPE_ETHERNET   1
 
#define NETDEV_TYPE_802_11   2
 
#define NETDEV_TYPE_BLUETOOTH   3
 
#define NETDEV_TYPE_LOOPBACK   4
 
#define MAKE_IP(a, b, c, d)    ((uint32_t)(d) << 24 | (uint32_t)(c) << 16 | (uint32_t)(b) << 8 | (uint32_t)(a))
 
#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 AUNET_GET_HARDWARE_ADDRESS   0x100
 
#define AUNET_SET_IPV4_ADDRESS   0x101
 
#define AUNET_GET_IPV4_ADDRESS   0x102
 
#define AUNET_GET_GATEWAY_ADDRESS   0x103
 
#define AUNET_SET_GATEWAY_ADDRESS   0x104
 
#define AUNET_GET_SUBNET_MASK   0x105
 
#define AUNET_SET_SUBNET_MASK   0x106
 
#define AUNET_GET_LINK_STATUS   0x107
 
#define AUNET_GET_IPV6_ADDRESS   0x108
 
#define AUNET_SET_IPV6_ADDRESS   0x109
 
#define AUNET_GET_IPV6_GATEWAY   0x10A
 
#define AUNET_SET_IPV6_GATEWAY   0x10B
 
#define AUNET_GET_IPV6_PREFIX   0x10C
 
#define AUNET_SET_IPV6_PREFIX   0x10D
 

Typedefs

typedef struct _netdev_ AuNetworkDevice
 

Functions

void AuInitialiseNet ()
 AuInitialiseNet – initialise network data structures.
 
AU_EXTERN AU_EXPORT void AuAddNetAdapter (AuVFSNode *netfs, char *name)
 AuAddNetAdapter – add a net adapter to the adapter list.
 
AU_EXTERN AU_EXPORT AuVFSNodeAuGetNetworkAdapter (char *name)
 AuGetNetworkAdapter – get a network adapter.
 
AuVFSNodeAuNetworkRoute (uint32_t address)
 AuNetworkRoute – select NIC for an IPv4 destination.
 
AuVFSNodeAuNetworkRoute6 (const ip6_addr *address)
 
int AuAddrIsLocal4 (uint32_t address)
 
int AuAddrIsLocal6 (const ip6_addr *address)
 
void AuNetAddConnectedRoute4 (AuVFSNode *nic, const char *ifname)
 
void AuNetAddConnectedRoute6 (AuVFSNode *nic, const char *ifname)
 

Macro Definition Documentation

◆ AUNET_GET_GATEWAY_ADDRESS

#define AUNET_GET_GATEWAY_ADDRESS   0x103

◆ AUNET_GET_HARDWARE_ADDRESS

#define AUNET_GET_HARDWARE_ADDRESS   0x100

◆ AUNET_GET_IPV4_ADDRESS

#define AUNET_GET_IPV4_ADDRESS   0x102

◆ AUNET_GET_IPV6_ADDRESS

#define AUNET_GET_IPV6_ADDRESS   0x108

◆ AUNET_GET_IPV6_GATEWAY

#define AUNET_GET_IPV6_GATEWAY   0x10A

◆ AUNET_GET_IPV6_PREFIX

#define AUNET_GET_IPV6_PREFIX   0x10C

◆ AUNET_GET_LINK_STATUS

#define AUNET_GET_LINK_STATUS   0x107

◆ AUNET_GET_SUBNET_MASK

#define AUNET_GET_SUBNET_MASK   0x105

◆ AUNET_SET_GATEWAY_ADDRESS

#define AUNET_SET_GATEWAY_ADDRESS   0x104

◆ AUNET_SET_IPV4_ADDRESS

#define AUNET_SET_IPV4_ADDRESS   0x101

◆ AUNET_SET_IPV6_ADDRESS

#define AUNET_SET_IPV6_ADDRESS   0x109

◆ AUNET_SET_IPV6_GATEWAY

#define AUNET_SET_IPV6_GATEWAY   0x10B

◆ AUNET_SET_IPV6_PREFIX

#define AUNET_SET_IPV6_PREFIX   0x10D

◆ AUNET_SET_SUBNET_MASK

#define AUNET_SET_SUBNET_MASK   0x106

◆ htonl

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

◆ htons

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

◆ MAKE_IP

#define MAKE_IP (   a,
  b,
  c,
 
)     ((uint32_t)(d) << 24 | (uint32_t)(c) << 16 | (uint32_t)(b) << 8 | (uint32_t)(a))

◆ NETDEV_TYPE_802_11

#define NETDEV_TYPE_802_11   2

◆ NETDEV_TYPE_BLUETOOTH

#define NETDEV_TYPE_BLUETOOTH   3

◆ NETDEV_TYPE_ETHERNET

#define NETDEV_TYPE_ETHERNET   1

BSD 2-Clause License

Copyright (c) 2022-2023, 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.

◆ NETDEV_TYPE_LOOPBACK

#define NETDEV_TYPE_LOOPBACK   4

◆ ntohl

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

◆ ntohs

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

Typedef Documentation

◆ AuNetworkDevice

typedef struct _netdev_ AuNetworkDevice

Function Documentation

◆ AuAddNetAdapter()

AU_EXTERN AU_EXPORT void AuAddNetAdapter ( AuVFSNode netfs,
char *  name 
)

AuAddNetAdapter – add a net adapter to the adapter list.

◆ AuAddrIsLocal4()

int AuAddrIsLocal4 ( uint32_t  address)
extern

◆ AuAddrIsLocal6()

int AuAddrIsLocal6 ( const ip6_addr address)
extern

◆ AuGetNetworkAdapter()

AU_EXTERN AU_EXPORT AuVFSNode * AuGetNetworkAdapter ( char *  name)

AuGetNetworkAdapter – get a network adapter.

Parameters
name– adapter name

◆ AuInitialiseNet()

void AuInitialiseNet ( )
extern

AuInitialiseNet – initialise network data structures.

◆ AuNetAddConnectedRoute4()

void AuNetAddConnectedRoute4 ( AuVFSNode nic,
const char *  ifname 
)
extern

◆ AuNetAddConnectedRoute6()

void AuNetAddConnectedRoute6 ( AuVFSNode nic,
const char *  ifname 
)
extern

◆ AuNetworkRoute()

AuVFSNode * AuNetworkRoute ( uint32_t  address)
extern

AuNetworkRoute – select NIC for an IPv4 destination.

Parameters
address– Address to consider (MAKE_IP/wire or host-order sockaddr)

◆ AuNetworkRoute6()

AuVFSNode * AuNetworkRoute6 ( const ip6_addr address)
extern