OpenNet
IPv6.h
Aller à la documentation de ce fichier.
1 
2 // Product OpenNet
3 
7 
8 // TEST COVERAGE 2019-05-10 KMS - Martin Dubois, ing.
9 
10 #pragma once
11 
12 // Includes
14 
15 // ===== Includes ===========================================================
16 #include <OpenNetK/ByteOrder.h>
17 
18 // Constants
20 
27 #define IPv6_ETHERNET_TYPE_nh (0xdd86)
28 
35 #define IPv6_HEADER_SIZE_byte (40)
36 
37 #ifndef _OPEN_NET_NO_FUNCTION_
38 
39 // Functions
41 
42 // LIMITATION IPv6.MultiHeader
43 // Not supported
44 
55 OPEN_NET_GLOBAL unsigned char * IPv6_Data(OPEN_NET_GLOBAL unsigned char * aData)
56 {
57  return ( aData + IPv6_HEADER_SIZE_byte );
58 }
59 
70 unsigned int IPv6_DataSize(OPEN_NET_GLOBAL unsigned char * aData)
71 {
72  return ByteOrder_Swap16(*((OPEN_NET_GLOBAL unsigned short *)(aData + 4)));
73 }
74 
87 OPEN_NET_GLOBAL unsigned short * IPv6_Destination(OPEN_NET_GLOBAL unsigned char * aData)
88 {
89  return ((OPEN_NET_GLOBAL unsigned short *)(aData + 24));
90 }
91 
102 unsigned char IPv6_Protocol(OPEN_NET_GLOBAL unsigned char * aData)
103 {
104  return aData[6];
105 }
106 
117 OPEN_NET_GLOBAL unsigned short * IPv6_Source(OPEN_NET_GLOBAL unsigned char * aData)
118 {
119  return ((OPEN_NET_GLOBAL unsigned short *)(aData + 8));
120 }
121 
122 #endif // ! _OPEN_NET_NO_FUNCTION_
unsigned int IPv6_DataSize(OPEN_NET_GLOBAL unsigned char *aData)
Cette fonction retourne la taille de la charge utile.
Definition: IPv6.h:70
#define IPv6_HEADER_SIZE_byte
La taille de l'entête IPv6.
Definition: IPv6.h:35
unsigned short ByteOrder_Swap16(unsigned short aIn)
Renverse l'ordre des octets.
Definition: ByteOrder.h:29
OPEN_NET_GLOBAL unsigned short * IPv6_Source(OPEN_NET_GLOBAL unsigned char *aData)
Cette fonction retourne un pointeur vers l'adresse de provenance.
Definition: IPv6.h:117
ByteOrder_Swap16, ByteOrder_Swap32 (RT)
OPEN_NET_GLOBAL unsigned char * IPv6_Data(OPEN_NET_GLOBAL unsigned char *aData)
Cette fonction retourne un pointeur vers la charge utile.
Definition: IPv6.h:55
OPEN_NET_GLOBAL unsigned short * IPv6_Destination(OPEN_NET_GLOBAL unsigned char *aData)
Cette fonction retourne un pointeur vers l'adresse de destination.
Definition: IPv6.h:87
unsigned char IPv6_Protocol(OPEN_NET_GLOBAL unsigned char *aData)
Cette fonction retourne le protocole.
Definition: IPv6.h:102