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

ChocoOS. More...

#include <oc_udp.h>
#include <oc_intman.h>
#include <oc_list.h>
#include <oc_event.h>
#include <oc_mutex.h>
#include <oc_module.h>
#include <oc_processman.h>
#include <oc_memman.h>
#include <oc_netifman.h>

Go to the source code of this file.

Data Structures

struct  ReservationData_t
 
struct  SavedPacket_t
 
struct  PacketFilterData_t
 

Functions

static bool PacketFilterFunction (oC_Net_Packet_t *Packet, const void *Parameter, oC_Netif_t Netif)
 function used in NetifMan for filtering packets
 
static ReservationData_tFindReservation (oC_Udp_Port_t Port, oC_Process_t Process)
 finds reservation of port or process
 
static uint16_t CalculateChecksum (oC_Udp_Packet_t *Packet)
 calculates checksum for a packet
 
static bool IsSpecialPort (oC_Udp_Port_t Port)
 returns true if port is special port
 
static bool IsPortReserved (oC_Udp_Port_t Port)
 checks if port is reserved
 
static void ConvertHeaderToNetworkEndianess (oC_Udp_Header_t *Header)
 converts UDP header to network endianess
 
static void ConvertHeaderFromNetworkEndianess (oC_Udp_Header_t *Header)
 converts UDP header from network endianess
 
oC_ErrorCode_t oC_Udp_TurnOn (void)
 turns on UDP module More...
 
oC_ErrorCode_t oC_Udp_TurnOff (void)
 turns off UDP module More...
 
bool oC_Udp_IsPortReserved (oC_Udp_Port_t Port, oC_Process_t Process)
 checks if the given UDP port is reserved More...
 
oC_ErrorCode_t oC_Udp_ReservePort (oC_Udp_Port_t *Port, oC_Time_t Timeout)
 reserves a UDP port More...
 
oC_ErrorCode_t oC_Udp_ReleasePort (oC_Udp_Port_t Port, oC_Time_t Timeout)
 releases a port More...
 
oC_ErrorCode_t oC_Udp_ReleaseAllPortsReservedBy (oC_Process_t Process, oC_Time_t Timeout)
 releases all ports reserved by the process More...
 
uint16_t oC_Udp_Packet_GetMaximumDataSize (oC_Net_PacketType_t Type)
 returns maximum size of the data for UDP packet
 
oC_Udp_Packet_toC_Udp_Packet_New (Allocator_t PacketAllocator, oC_Net_PacketType_t Type, const void *Data, uint16_t Size)
 allocates memory for a UDP packet More...
 
bool oC_Udp_Packet_Delete (oC_Udp_Packet_t **Packet)
 release memory allocated for a UDP packet
 
uint16_t oC_Udp_Packet_GetDataSize (const oC_Udp_Packet_t *Packet)
 returns size of the data inside UDP packet
 
bool oC_Udp_Packet_SetData (oC_Udp_Packet_t *Packet, const void *Data, uint16_t Size)
 sets data inside UDP packet
 
oC_ErrorCode_t oC_Udp_Packet_ReadData (const oC_Udp_Packet_t *Packet, void *outData, uint16_t Size)
 reads data of the UDP packet
 
void * oC_Udp_Packet_GetDataReference (oC_Udp_Packet_t *Packet)
 returns reference to the data inside UDP packet
 
oC_ErrorCode_t oC_Udp_Send (oC_Netif_t Netif, oC_Udp_Port_t LocalPort, const oC_Net_Address_t *Destination, oC_Udp_Packet_t *Packet, oC_Time_t Timeout)
 sends UDP packet More...
 
oC_ErrorCode_t oC_Udp_Receive (oC_Netif_t Netif, oC_Udp_Port_t LocalPort, oC_Udp_Packet_t *Packet, oC_Time_t Timeout)
 receives UDP packet More...
 
oC_ErrorCode_t oC_Udp_CalculateChecksum (oC_Udp_Packet_t *Packet, bool *outChecksumCorrect, uint16_t *outExpectedChecksum)
 Calculates checksum for UDP packet. More...
 

Detailed Description


Author
Patryk Kubiak
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_udp.c.