The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
unknownframe.c
Go to the documentation of this file.
1 
25 #include <string.h>
26 #include <projectcommon.h>
27 #include <frameset.h>
28 #include <unknownframe.h>
29 #include <frametypes.h>
30 #include <generic_tlv_min.h>
31 #include <tlvhelper.h>
32 
33 FSTATIC gboolean _unknownframe_default_isvalid(const Frame *, gconstpointer, gconstpointer);
34 
39 
41 FSTATIC gboolean
43  gconstpointer tlvptr,
44  gconstpointer pktend)
45 {
46  (void)self; (void)tlvptr; (void)pktend;
48  return FALSE;
49 }
50 
51 
55 unknownframe_new(guint16 frame_type)
56 {
57  Frame* baseframe;
58 
59  baseframe = frame_new(frame_type, sizeof(UnknownFrame));
61  proj_class_register_subclassed (baseframe, "UnknownFrame");
62 
63  return CASTTOCLASS(UnknownFrame, baseframe);
64 }
65 
66 
69 Frame*
70 unknownframe_tlvconstructor(gconstpointer tlvstart, gconstpointer pktend)
71 {
72  guint16 frametype = get_generic_tlv_type(tlvstart, pktend);
73  guint16 framelength = get_generic_tlv_len(tlvstart, pktend);
74  const guint8* framevalue = get_generic_tlv_value(tlvstart, pktend);
75  UnknownFrame * ret = unknownframe_new(frametype);
76  Frame * fret = CASTTOCLASS(Frame, ret);
77  g_return_val_if_fail(ret != NULL, NULL);
78 
79  ret->baseclass.length = framelength;
80  fret->setvalue(fret, g_memdup(framevalue, framelength), framelength, frame_default_valuefinalize);
81  return fret;
82 }