00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef VFER_DATAGRAM_H
00016 #define VFER_DATAGRAM_H
00017
00018
00019
00020
00021
00022 #include <sys/uio.h>
00023 #include <stdio.h>
00024 #include <netinet/in.h>
00025 #include <arpa/inet.h>
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #define MAX_VECS 3
00036
00037
00038
00039
00040 typedef struct frame_stats {
00041 uint32_t vec_acks;
00042 uint32_t first_frag_time;
00043 uint32_t last_frag_time;
00044 uint32_t frags_complete;
00045 uint32_t frags_incomplete;
00046 } frame_stats;
00047
00048
00049
00050
00051 typedef struct interval {
00052 uint32_t start;
00053 uint32_t end;
00054 struct interval* prev;
00055 struct interval* next;
00056 } interval_t;
00057
00058
00059
00060
00061 typedef struct intervals {
00062 struct interval* head;
00063 uint32_t count;
00064 } intervals_t;
00065
00066
00067
00068
00069 typedef struct frame {
00070 void* data;
00071 int len;
00072 uint32_t frame_num;
00073 intervals_t missing_data;
00074 char done;
00075 int urgency;
00076 frame_stats stats;
00077 } frame;
00078
00079
00080
00081
00082 typedef struct frame_link {
00083 struct frame frame;
00084 struct frame_link* next;
00085 } frame_link;
00086
00087
00088
00089
00090 typedef struct frame_list {
00091 int num;
00092 uint32_t length;
00093 uint16_t last_frame_num;
00094 uint16_t first_frame_num;
00095 struct frame_link* first;
00096 struct frame_link* last;
00097 } frame_list;
00098
00099
00100
00101
00102
00103 inline int Datagram_Enqueue (frame_list* frames, const void* buffer, int len, int frame_num);
00104 inline int Datagram_Dequeue (frame_list* frames, void* buffer, int len);
00105 inline void Datagram_Remove (frame_list* list, frame_link* prev, frame_link* remove);
00106 inline void Datagram_Insert (frame_list* list, frame_link* prev, frame_link* insert);
00107 inline frame_link* Datagram_Insert_Phantom (frame_list* list, frame_link* prev, int frame_num);
00108 void Datagrams_Print (frame_list* list);
00109 inline void Datagrams_Clear (frame_list* list);
00110
00111 #endif