The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
compressframe.c
Go to the documentation of this file.
1 
26 #include <string.h>
27 #include <projectcommon.h>
28 #include <frameset.h>
29 #include <compressframe.h>
30 #include <frametypes.h>
31 #include <generic_tlv_min.h>
32 #include <tlvhelper.h>
33 
34 FSTATIC gboolean _compressframe_default_isvalid(const Frame *, gconstpointer, gconstpointer);
35 
41 
44 FSTATIC gboolean
46  gconstpointer tlvptr,
47  gconstpointer pktend)
48 {
49  const CompressFrame* cself = CASTTOCONSTCLASS(CompressFrame, self);
50 
51  if (tlvptr == NULL) {
52  return cself->compression_method > 0;
53  }
54  (void)pktend;
55  return FALSE;
56 }
57 
58 
62 compressframe_new(guint16 frame_type,
63  guint16 compression_method)
64 {
65  Frame* baseframe;
66  CompressFrame* cmpframe;
67 
68 
69  baseframe = frame_new(frame_type, sizeof(CompressFrame));
71  proj_class_register_subclassed (baseframe, "CompressFrame");
72 
73  cmpframe = CASTTOCLASS(CompressFrame, baseframe);
74  cmpframe->compression_method = compression_method;
75  return cmpframe;
76 }
82 compressframe_tlvconstructor(gconstpointer tlvstart,
83  gconstpointer pktend)
84 {
85  guint16 frametype = get_generic_tlv_type(tlvstart, pktend);
86  guint16 framelength = get_generic_tlv_len(tlvstart, pktend);
87  const guint8* framevalue = get_generic_tlv_value(tlvstart, pktend);
88  //CompressFrame * ret = compressframe_new(frametype, 0);
89  //Frame * fret = CASTTOCLASS(Frame, ret);
90  //g_return_val_if_fail(ret != NULL, NULL);
91 
92  //ret->baseclass.length = framelength;
93  //ret->baseclass.setvalue(fret, g_memdup(framevalue, framelength), framelength, _frame_default_valuefinalize);
94  (void)frametype;
95  (void)framelength;
96  (void)framevalue;
97  return NULL;
98 }