{"id":140,"date":"2014-07-04T16:42:41","date_gmt":"2014-07-04T16:42:41","guid":{"rendered":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/?p=140"},"modified":"2015-07-13T11:42:45","modified_gmt":"2015-07-13T11:42:45","slug":"the-ovm_snmpoid_t-type","status":"publish","type":"post","link":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/?p=140","title":{"rendered":"The ovm_snmpoid_t type"},"content":{"rendered":"<p>The <code>ovm_snmpoid_t<\/code> type is the OrchIDS type of <a title=\"SNMP\" href=\"https:\/\/en.wikipedia.org\/wiki\/Simple_Network_Management_Protocol\">SNMP<\/a> object identifiers.<!--more--><\/p>\n<p>It is defined this way in <code>src\/lang.h<\/code>:<\/p>\n<pre>typedef struct ovm_snmpoid_s ovm_snmpoid_t;\r\nstruct ovm_snmpoid_s\r\n{\r\n  gc_header_t gc;\r\n  size_t    len;\r\n  oid_t     objoid[STR_PAD_LEN];\r\n};<\/pre>\n<p>The length <code>STR_PAD_LEN<\/code> is a dummy value: the actual number of object identifiers in the array <code>objoid<\/code> is <code>len<\/code>.<\/p>\n<p>The type <code>ovm_snmpoid_t<\/code> is a type of <a title=\"Garbage collection\" href=\"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/?p=18\">garbage-collectable<\/a> data. To allocate a new object of type <code>ovm_snmpoid_t<\/code>, use the function:<\/p>\n<pre>ovm_var_t *ovm_snmpoid_new(gc_t *gc_ctx, size_t len);<\/pre>\n<p>This creates a new <code>ovm_snmpoid_t<\/code> object, with the given <code>len<\/code>. Calling <code>res<\/code> the result, one always has <code>TYPE(res)==T_SNMPOID<\/code>. The <code>objoid<\/code> array is left uninitialized. One can access it using <code>SNMPOID(res)<\/code>, and its length by <code>SNMPOIDLEN(res)<\/code>.<\/p>\n<p>The return type of <code>ovm_snmpoid_new()<\/code> is the universal type <a title=\"The ovm_var_t universal type\" href=\"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/?page_id=121\"><code>ovm_var_t<\/code><\/a> instead of <code>ovm_vbstr_t<\/code>, for practical reasons.<\/p>\n<p>The result is created white, and much be <code>gc_touch()<\/code>ed before storing it into a garbage-collectable object.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The ovm_snmpoid_t type is the OrchIDS type of SNMP object identifiers.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4],"tags":[],"class_list":["post-140","post","type-post","status-publish","format-standard","hentry","category-data-types","category-virtual-machine"],"_links":{"self":[{"href":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/index.php?rest_route=\/wp\/v2\/posts\/140","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=140"}],"version-history":[{"count":2,"href":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/index.php?rest_route=\/wp\/v2\/posts\/140\/revisions"}],"predecessor-version":[{"id":285,"href":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/index.php?rest_route=\/wp\/v2\/posts\/140\/revisions\/285"}],"wp:attachment":[{"href":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/projects.lsv.ens-paris-saclay.fr\/orchidsdev\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}