if (!pinfo->expired) pinfo->expired = TRUE; else g_free(pinfo); return 0; } /* This table is ultimately registered as a sub-table of the class' metatable, * and if __index/__newindex is invoked then it calls the appropriate function * from this table for getting/setting the members. */ WSLUA_ATTRIBUTES Pinfo_attributes[] = { WSLUA_ATTRIBUTE_ROREG(Pinfo,number), WSLUA_ATTRIBUTE_ROREG(Pinfo,len), WSLUA_ATTRIBUTE_ROREG(Pinfo,caplen), WSLUA_ATTRIBUTE_ROREG(Pinfo,abs_ts), WSLUA_ATTRIBUTE_ROREG(Pinfo,rel_ts), WSLUA_ATTRIBUTE_ROREG(Pinfo,delta_ts), WSLUA_ATTRIBUTE_ROREG(Pinfo,delta_dis_ts), WSLUA_ATTRIBUTE_ROREG(Pinfo,visited), WSLUA_ATTRIBUTE_RWREG(Pinfo,src), WSLUA_ATTRIBUTE_RWREG(Pinfo,dst), WSLUA_ATTRIBUTE_ROREG(Pinfo,lo), WSLUA_ATTRIBUTE_ROREG(Pinfo,hi), WSLUA_ATTRIBUTE_RWREG(Pinfo,dl_src), WSLUA_ATTRIBUTE_RWREG(Pinfo,dl_dst), WSLUA_ATTRIBUTE_RWREG(Pinfo,net_src), WSLUA_ATTRIBUTE_RWREG(Pinfo,net_dst),
} static int CaptureInfoConst_set_private_table(lua_State* L) { CaptureInfoConst fi = checkCaptureInfoConst(L,1); return set_wdh_priv_table_ref(L, fi->wdh); } static int CaptureInfoConst__gc(lua_State* L) { CaptureInfoConst fi = toCaptureInfoConst(L,1); if (fi) g_free(fi); return 0; } WSLUA_ATTRIBUTES CaptureInfoConst_attributes[] = { WSLUA_ATTRIBUTE_ROREG(CaptureInfoConst,encap), WSLUA_ATTRIBUTE_ROREG(CaptureInfoConst,type), WSLUA_ATTRIBUTE_ROREG(CaptureInfoConst,snapshot_length), WSLUA_ATTRIBUTE_ROREG(CaptureInfoConst,comment), WSLUA_ATTRIBUTE_ROREG(CaptureInfoConst,hardware), WSLUA_ATTRIBUTE_ROREG(CaptureInfoConst,os), WSLUA_ATTRIBUTE_ROREG(CaptureInfoConst,user_app), WSLUA_ATTRIBUTE_ROREG(CaptureInfoConst,hosts), WSLUA_ATTRIBUTE_RWREG(CaptureInfoConst,private_table), { NULL, NULL, NULL } }; WSLUA_META CaptureInfoConst_meta[] = { WSLUA_CLASS_MTREG(CaptureInfoConst,tostring), { NULL, NULL } };
if (!fi->expired) fi->expired = TRUE; else /* do NOT free fi->ws_fi */ g_free(fi); return 0; } /* This table is ultimately registered as a sub-table of the class' metatable, * and if __index/__newindex is invoked then it calls the appropriate function * from this table for getting/setting the members. */ WSLUA_ATTRIBUTES FieldInfo_attributes[] = { WSLUA_ATTRIBUTE_ROREG(FieldInfo,range), WSLUA_ATTRIBUTE_ROREG(FieldInfo,generated), WSLUA_ATTRIBUTE_ROREG(FieldInfo,hidden), WSLUA_ATTRIBUTE_ROREG(FieldInfo,is_url), WSLUA_ATTRIBUTE_ROREG(FieldInfo,little_endian), WSLUA_ATTRIBUTE_ROREG(FieldInfo,big_endian), WSLUA_ATTRIBUTE_ROREG(FieldInfo,name), WSLUA_ATTRIBUTE_ROREG(FieldInfo,display), WSLUA_ATTRIBUTE_ROREG(FieldInfo,type), WSLUA_ATTRIBUTE_ROREG(FieldInfo,source), { "label", FieldInfo__tostring, NULL }, { "value", FieldInfo__call, NULL }, { "tvb", FieldInfo_get_range, NULL }, { "len", FieldInfo__len, NULL }, { "offset", FieldInfo__unm, NULL }, { NULL, NULL, NULL }