Contiki 2.5
eid.h
Go to the documentation of this file.
1 /**
2  * \addtogroup agent
3  * @{
4  */
5 
6 /**
7  * \defgroup eid EID Representation and Helper Methods
8  *
9  * @{
10  */
11 
12 /**
13  * \file
14  * \brief this file defines the memory representation of an EID and provides methods for construction and parsing
15  *
16  * \author Wolf-Bastian Poettner <poettner@ibr.cs.tu-bs.de>
17  */
18 
19 #include <stdint.h>
20 
21 #include "contiki.h"
22 
23 #ifndef __EID_H__
24 #define __EID_H__
25 
26 /**
27  * \brief Parses an incoming string and fills out the EID struct
28  *
29  * \param buffer Pointer to the string buffer
30  * \param length Length of the string buffer
31  * \param eid Pointer to the EID struct that should be filled out
32  *
33  * \return Returns length of parsed EID on success or -1 on error
34  */
35 int eid_parse_host(char * buffer, uint8_t length, uint32_t * node_id);
36 
37 /**
38  * \brief Parses an byte buffer that contains the SDNV length and an EID string and fills out the EID struct
39  *
40  * \param buffer Pointer to the string buffer
41  * \param length Length of the string buffer
42  * \param eid Pointer to the EID struct that should be filled out
43  *
44  * \return Returns length of parsed EID on success or -1 on error
45  */
46 int eid_parse_host_length(uint8_t * buffer, uint8_t length, uint32_t * node_id);
47 
48 /**
49  * \brief Parses an incoming string and fills out the EID struct
50  *
51  * \param buffer Pointer to the string buffer
52  * \param length Length of the string buffer
53  * \param eid Pointer to the EID struct that should be filled out
54  *
55  * \return Returns length of parsed EID on success or -1 on error
56  */
57 int eid_parse_full(char * buffer, uint8_t length, uint32_t * node_id, uint32_t * service_id);
58 
59 /**
60  * \brief Parses an byte buffer that contains the SDNV length and an EID string and fills out the EID struct
61  *
62  * \param buffer Pointer to the string buffer
63  * \param length Length of the string buffer
64  * \param eid Pointer to the EID struct that should be filled out
65  *
66  * \return Returns length of parsed EID on success or -1 on error
67  */
68 int eid_parse_full_length(uint8_t * buffer, uint8_t length, uint32_t * node_id, uint32_t * service_id);
69 
70 /**
71  * \brief Converts the EID struct into a string representation
72  *
73  * \param eid Pointer to the EID struct
74  * \param buffer Pointer to the string buffer
75  * \param length Length of the string buffer
76  *
77  * \return Returns length of string on success or -1 on error
78  */
79 int eid_create_host(uint32_t node_id, char * buffer, uint8_t length);
80 
81 /**
82  * \brief Converts the EID struct into a string representation prefixed with the SDNV-encoded length
83  *
84  * \param eid Pointer to the EID struct
85  * \param buffer Pointer to the string buffer
86  * \param length Length of the string buffer
87  *
88  * \return Returns length of string on success or -1 on error
89  */
90 int eid_create_host_length(uint32_t node_id, uint8_t * buffer, uint8_t length);
91 
92 /**
93  * \brief Converts the EID struct into a string representation
94  *
95  * \param eid Pointer to the EID struct
96  * \param buffer Pointer to the string buffer
97  * \param length Length of the string buffer
98  *
99  * \return Returns length of string on success or -1 on error
100  */
101 int eid_create_full(uint32_t node_id, uint32_t service_id, char * buffer, uint8_t length);
102 
103 /**
104  * \brief Converts the EID struct into a string representation prefixed with the SDNV-encoded length
105  *
106  * \param eid Pointer to the EID struct
107  * \param buffer Pointer to the string buffer
108  * \param length Length of the string buffer
109  *
110  * \return Returns length of string on success or -1 on error
111  */
112 int eid_create_full_length(uint32_t node_id, uint32_t service_id, uint8_t * buffer, uint8_t length);
113 
114 #endif
115 /** @} */
116 /** @} */