Choco OS  V.0.16.9.0
Join to the chocolate world
oc_netif.c File Reference

File with functions of Netif object. More...

#include <oc_netif.h>
#include <oc_object.h>
#include <oc_driver.h>
#include <oc_stdlib.h>
#include <oc_intman.h>
#include <oc_string.h>
#include <oc_semaphore.h>
#include <oc_dhcp.h>
#include <oc_debug.h>
#include <oc_ktime.h>
#include <oc_compiler.h>

Go to the source code of this file.

Data Structures

struct  AddressResolutionEntry_t
 
struct  PACKED
 stores IPv6 address More...
 
struct  Netif_t
 

Functions

static ArpHardwareType_t HardwareTypeToArpHardwareType (oC_Net_HardwareType_t Type)
 translates hardware type to ARP hardware type
 
static oC_Net_PacketType_t ArpProtocolToPacketType (ArpProtocolType_t Type)
 translates ARP protocol type to packet type
 
static ArpProtocolType_t PacketTypeToArpProtocol (oC_Net_PacketType_t Type)
 translates ARP protocol type from packet type
 
static bool ReadHardwareAddressOf (oC_Netif_t Netif, const oC_Net_Address_t *Address, oC_Net_HardwareAddress_t *outHardwareAddress)
 reads hw address from the ARP list in the netif
 
static oC_ErrorCode_t RequestHardwareAddressViaArp (oC_Netif_t Netif, const oC_Net_Address_t *Address, oC_Net_HardwareAddress_t *outHardwareAddress, oC_Time_t Timeout)
 requests hardware address via ARP protocol
 
static void SaveHardwareAddress (oC_Netif_t Netif, oC_Net_HardwareAddress_t *HardwareAddress, oC_Net_Address_t *IpAddress)
 saves HW address in ARP list
 
static void SaveHardwareAddressFromArp (oC_Netif_t Netif, ArpPacket_t *Packet, oC_Time_t Timeout)
 saves hardware address from ARP message
 
static oC_ErrorCode_t SendArpPacket (oC_Netif_t Netif, ArpOperation_t Operation, oC_Net_HardwareAddress_t *TargetHwAddress, oC_Net_Address_t *IpAddress, oC_Time_t Timeout)
 sends ARP packet
 
static void ConvertArpFromNetworkEndianess (ArpPacket_t *Packet)
 converts ARP packet from network endianess
 
static void ConvertArpToNetworkEndianess (ArpPacket_t *Packet)
 converts ARP packet to network endianess
 
oC_Netif_t oC_Netif_New (oC_Netif_FriendlyName_t FriendlyName, const char *AddressString, const char *NetMaskAddressString, oC_Driver_t Driver, const void *Config)
 Creates Netif object. More...
 
bool oC_Netif_Delete (oC_Netif_t *outNetif)
 deletes netif object More...
 
bool oC_Netif_IsCorrect (oC_Netif_t Netif)
 checks if the Netif object is correct More...
 
bool oC_Netif_IsConfigured (oC_Netif_t Netif)
 checks if the driver is configured More...
 
const char * oC_Netif_GetFriendlyName (oC_Netif_t Netif)
 returns friendly name of the network interface More...
 
oC_Driver_t oC_Netif_GetDriver (oC_Netif_t Netif)
 returns driver related with the Netif More...
 
oC_ErrorCode_t oC_Netif_Configure (oC_Netif_t Netif)
 configures network driver to work with netif More...
 
oC_ErrorCode_t oC_Netif_Unconfigure (oC_Netif_t Netif)
 unconfigures network driver related with the Netif More...
 
oC_ErrorCode_t oC_Netif_ReadNetInfo (oC_Netif_t Netif, oC_Net_Info_t *outInfo)
 reads informations about network interface More...
 
oC_ErrorCode_t oC_Netif_SendPacket (oC_Netif_t Netif, oC_Net_Packet_t *Packet, oC_Time_t Timeout)
 sends packet by using the network interface More...
 
oC_ErrorCode_t oC_Netif_ReceivePacket (oC_Netif_t Netif, oC_Net_Packet_t *Packet, oC_MemorySize_t PacketSize, oC_Time_t Timeout)
 receives packet by using the interface More...
 
oC_ErrorCode_t oC_Netif_SetWakeOnLanEvent (oC_Netif_t Netif, oC_Event_t WolEvent)
 sets wake on LAN event More...
 
oC_ErrorCode_t oC_Netif_Flush (oC_Netif_t Netif)
 flushes Network interface More...
 
oC_ErrorCode_t oC_Netif_SetLoopback (oC_Netif_t Netif, oC_Net_Layer_t Layer, bool Enabled)
 enables or disables loopback More...
 
oC_ErrorCode_t oC_Netif_PerformDiagnostics (oC_Netif_t Netif, oC_Diag_t *outDiags, uint32_t *NumberOfDiags)
 performs diagnostics of the network interface More...
 
oC_Net_LinkStatus_t oC_Netif_GetLinkStatus (oC_Netif_t Netif)
 returns last known link status of the network interface More...
 
oC_BaudRate_t oC_Netif_GetBaudRate (oC_Netif_t Netif)
 returns baud rate of the network interface More...
 
oC_Net_HardwareType_t oC_Netif_GetHardwareType (oC_Netif_t Netif)
 returns hardware type of the network interface More...
 
oC_ErrorCode_t oC_Netif_ReadHardwareAddress (oC_Netif_t Netif, oC_Net_HardwareAddress_t *outHardwareAddress)
 reads hardware address of the interface More...
 
oC_ErrorCode_t oC_Netif_ReadHardwareAddressOf (oC_Netif_t Netif, oC_Net_HardwareAddress_t *outHardwareAddress, const oC_Net_Address_t *Address, oC_Time_t Timeout)
 reads hardware address of the given IP address in LAN More...
 
oC_ErrorCode_t oC_Netif_SetIpv4Info (oC_Netif_t Netif, const oC_Net_Ipv4Info_t *Info)
 sets informations about IPv4 More...
 
oC_ErrorCode_t oC_Netif_ReadIpv4Info (oC_Netif_t Netif, oC_Net_Ipv4Info_t *outInfo)
 reads IPv4 informations More...
 
oC_ErrorCode_t oC_Netif_SetIpv6Info (oC_Netif_t Netif, const oC_Net_Ipv6Info_t *Info)
 sets informations about IPv6 More...
 
oC_ErrorCode_t oC_Netif_ReadIpv6Info (oC_Netif_t Netif, oC_Net_Ipv6Info_t *outInfo)
 reads IPv6 informations More...
 
bool oC_Netif_IsAddressInSubnet (oC_Netif_t Netif, const oC_Net_Address_t *Address)
 checks if the given address belongs to the given subnet More...
 
oC_Net_Ipv4_t oC_Netif_GetIpv4Address (oC_Netif_t Netif)
 returns address of the network interface
 
bool oC_Netif_ReadIpv6Address (oC_Netif_t Netif, oC_Net_Ipv6_t *outAddress)
 reads IPv6 address of the network interface
 
oC_ErrorCode_t oC_Netif_UpdateLinkStatus (oC_Netif_t Netif)
 updates link status in the network interface object More...
 
bool oC_Netif_IsIpAssigned (oC_Netif_t Netif)
 returns true if IP is assigned
 
oC_ErrorCode_t oC_Netif_WaitOnLink (oC_Netif_t Netif, oC_Time_t Timeout)
 waits for the link and updates IP More...
 
oC_ErrorCode_t oC_Netif_UpdateIp (oC_Netif_t Netif, oC_Time_t Timeout)
 updates IP in the given network interface More...
 
oC_ErrorCode_t oC_Netif_SetReceiveThread (oC_Netif_t Netif, oC_Thread_t Thread)
 sets thread for receiving packets More...
 
oC_ErrorCode_t oC_Netif_SetListenMode (oC_Netif_t Netif, bool Enabled)
 enables listen mode More...
 
bool oC_Netif_GetListenMode (oC_Netif_t Netif)
 returns true if listen mode is enabled
 
oC_ErrorCode_t oC_Netif_ReadReceiveThread (oC_Netif_t Netif, oC_Thread_t *outThread)
 sets thread for receiving packets More...
 
oC_ErrorCode_t oC_Netif_SendAddressProbe (oC_Netif_t Netif, oC_Time_t Timeout)
 sends frame that probes the address More...
 

Variables

static oC_Allocator_t Allocator
 

Detailed Description


Author
Patryk Kubiak
Joanna "Kotel" Kuczkowska
Note
Copyright (C) 2016 Patryk Kubiak patry.nosp@m.k.ku.nosp@m.biak9.nosp@m.0@gm.nosp@m.ail.c.nosp@m.om

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Definition in file oc_netif.c.

Variable Documentation

oC_Allocator_t Allocator
static
Initial value:
= {
.Name = "Netif" ,
}

Allocator for Netif object

Definition at line 155 of file oc_netif.c.