Contiki 2.5
statusreport.h
Go to the documentation of this file.
1 /**
2  * \addtogroup agent
3  * @{
4  */
5 
6 /**
7  * \defgroup bundle_status Bundle Status reports
8  * @{
9  */
10 
11 /**
12  * \file
13  * \author Georg von Zengen <vonzeng@ibr.cs.tu-bs.de>
14  * \author Wolf-Bastian Pšttner <poettner@ibr.cs.tu-bs.de>
15  */
16 
17 #ifndef STATUS_REPORT_H
18 #define STATUS_REPORT_H
19 
20 #include <stdint.h>
21 
22 #include "contiki.h"
23 #include "mmem.h"
24 
25 #include "bundle.h"
26 
27 /**
28  * Which status-report driver are we going to use?
29  */
30 #ifdef CONF_STATUSREPORT
31 #define STATUSREPORT CONF_STATUSREPORT
32 #else
33 #define STATUSREPORT statusreport_basic
34 #endif
35 
36 /*========================================== STATUS FLAGS ==========================================*/
37 
38 /**
39  * \brief The status flags for the status report
40  * @{
41  */
42 #define NODE_RECEIVED_BUNDLE (0x01)
43 #define NODE_ACCEPTED_CUSTODY (0x02)
44 #define NODE_FORWARDED_BUNDLE (0x04)
45 #define NODE_DELIVERED_BUNDLE (0x08)
46 #define NODE_DELETED_BUNDLE (0x10)
47 /** @} */
48 
49 /*================================ STATUS REPORT REASON CODES =================================*/
50 
51 /**
52  * \brief The reasons for the status report
53  * @{
54  */
55 #define NO_ADDITIONAL_INFORMATION (0x00)
56 #define LIFETIME_EXPIRED (0x01)
57 #define FORWARDED_OVER_UNIDIRECTIONAL_LINK (0x02)
58 #define TRANSMISSION_CANCELED (0x03)
59 #define DEPLETED_STORAGE (0x04)
60 #define DEST_EID_UNINTELLIGIBLE (0x05)
61 #define NO_KNOWN_ROUTE_TO_DEST (0x06)
62 #define NO_TIMELY_CONTACT_WITH_NEXT_NODE (0x07)
63 #define BLOCK_UNINTELLIGIBLE (0x08)
64 /** @} */
65 
66 /**
67  * \brief The structure of a status report as part of an administrative record
68  */
69 typedef struct {
70  uint8_t status_flags;
71  uint8_t reason_code;
72  uint8_t fragment;
73 
74  uint32_t fragment_offset;
75  uint32_t fragment_length;
76 
77  uint32_t dtn_time_seconds;
78  uint32_t dtn_time_nanoseconds;
79 
80  uint32_t bundle_creation_timestamp;
81  uint32_t bundle_sequence_number;
82 
83  uint32_t source_eid_node;
84  uint32_t source_eid_service;
86 
87 /**
88  * interface for status report modules
89  */
91  char *name;
92  /** sends a status report to the "report to"-node */
93  uint8_t (* send)(struct mmem * bundlemem, uint8_t status, uint8_t reason);
94 };
95 
96 int statusreport_encode(status_report_t * report, uint8_t * buffer, uint8_t length);
97 int statusreport_decode(status_report_t * report, uint8_t * buffer, uint8_t length);
98 
99 extern const struct status_report_driver STATUSREPORT;
100 
101 #endif
102 /** @} */
103 /** @} */