OpenWSN Firmware
packetfunctions.h
Go to the documentation of this file.
1 #ifndef __PACKETFUNCTIONS_H
2 #define __PACKETFUNCTIONS_H
3 
11 #include "openwsn.h"
12 
13 //=========================== define ==========================================
14 
15 //=========================== typedef =========================================
16 
17 //=========================== variables =======================================
18 
19 //=========================== prototypes ======================================
20 
21 // address translation
22 void packetfunctions_ip128bToMac64b(open_addr_t* ip128b,open_addr_t* prefix64btoWrite,open_addr_t* mac64btoWrite);
23 void packetfunctions_mac64bToIp128b(open_addr_t* prefix64b,open_addr_t* mac64b,open_addr_t* ip128bToWrite);
24 void packetfunctions_mac64bToMac16b(open_addr_t* mac64b, open_addr_t* mac16btoWrite);
25 void packetfunctions_mac16bToMac64b(open_addr_t* mac16b, open_addr_t* mac64btoWrite);
26 
27 // address recognition
31 bool packetfunctions_sameAddress(open_addr_t* address_1, open_addr_t* address_2);
32 
33 // read/write addresses to/from packets
34 void packetfunctions_readAddress(uint8_t* payload, uint8_t type, open_addr_t* writeToAddress, bool littleEndian);
35 void packetfunctions_writeAddress(OpenQueueEntry_t* msg, open_addr_t* address, bool littleEndian);
36 
37 // reserving/tossing headers and footers
38 void packetfunctions_reserveHeaderSize(OpenQueueEntry_t* pkt, uint8_t header_length);
39 void packetfunctions_tossHeader(OpenQueueEntry_t* pkt, uint8_t header_length);
40 void packetfunctions_reserveFooterSize(OpenQueueEntry_t* pkt, uint8_t header_length);
41 void packetfunctions_tossFooter(OpenQueueEntry_t* pkt, uint8_t header_length);
42 
43 // calculate CRC
46 
47 // calculate checksum
48 void packetfunctions_calculateChecksum(OpenQueueEntry_t* msg, uint8_t* checksum_ptr);
49 
50 // endianness
51 void packetfunctions_htons( uint16_t val, uint8_t* dest );
52 uint16_t packetfunctions_ntohs( uint8_t* src );
53 void packetfunctions_htonl( uint32_t val, uint8_t* dest );
54 uint32_t packetfunctions_ntohl( uint8_t* src );
55 
61 #endif
bool packetfunctions_isAllRoutersMulticast(open_addr_t *address)
Definition: packetfunctions.c:115
void packetfunctions_htons(uint16_t val, uint8_t *dest)
Definition: packetfunctions.c:418
void packetfunctions_tossHeader(OpenQueueEntry_t *pkt, uint8_t header_length)
Definition: packetfunctions.c:278
bool packetfunctions_sameAddress(open_addr_t *address_1, open_addr_t *address_2)
Definition: packetfunctions.c:165
void packetfunctions_mac16bToMac64b(open_addr_t *mac16b, open_addr_t *mac64btoWrite)
Definition: packetfunctions.c:61
void packetfunctions_mac64bToIp128b(open_addr_t *prefix64b, open_addr_t *mac64b, open_addr_t *ip128bToWrite)
Definition: packetfunctions.c:32
void packetfunctions_calculateCRC(OpenQueueEntry_t *msg)
Definition: packetfunctions.c:308
void packetfunctions_tossFooter(OpenQueueEntry_t *pkt, uint8_t header_length)
Definition: packetfunctions.c:297
bool packetfunctions_isAllHostsMulticast(open_addr_t *address)
Definition: packetfunctions.c:140
void packetfunctions_calculateChecksum(OpenQueueEntry_t *msg, uint8_t *checksum_ptr)
Definition: packetfunctions.c:356
uint16_t packetfunctions_ntohs(uint8_t *src)
Definition: packetfunctions.c:423
void packetfunctions_reserveFooterSize(OpenQueueEntry_t *pkt, uint8_t header_length)
Definition: packetfunctions.c:288
bool packetfunctions_isBroadcastMulticast(open_addr_t *address)
Definition: packetfunctions.c:82
Definition: openwsn.h:276
void packetfunctions_mac64bToMac16b(open_addr_t *mac64b, open_addr_t *mac16btoWrite)
Definition: packetfunctions.c:49
void packetfunctions_readAddress(uint8_t *payload, uint8_t type, open_addr_t *writeToAddress, bool littleEndian)
Definition: packetfunctions.c:199
uint32_t packetfunctions_ntohl(uint8_t *src)
Definition: packetfunctions.c:436
bool packetfunctions_checkCRC(OpenQueueEntry_t *msg)
Definition: packetfunctions.c:328
void packetfunctions_writeAddress(OpenQueueEntry_t *msg, open_addr_t *address, bool littleEndian)
Definition: packetfunctions.c:232
Definition: openwsn.h:288
void packetfunctions_htonl(uint32_t val, uint8_t *dest)
Definition: packetfunctions.c:429
void packetfunctions_reserveHeaderSize(OpenQueueEntry_t *pkt, uint8_t header_length)
Definition: packetfunctions.c:268
void packetfunctions_ip128bToMac64b(open_addr_t *ip128b, open_addr_t *prefix64btoWrite, open_addr_t *mac64btoWrite)
Definition: packetfunctions.c:16