[netsa-tools-discuss] Conflict in code

Michael Welsh Duggan mwd at cert.org
Thu Feb 8 10:17:27 EST 2018


amir ranjbar <amirpaz1377 at gmail.com> writes:

> I want to create an enterprise-specific information element and after that
> make an option template and record.
> I found this document and act like that :
> https://tools.netsa.cert.org/fixbuf/libfixbuf/rfc_5610.html
> I got some errors in  calling this function:
> fbInfoElementWriteOptionsRecord
> <https://tools.netsa.cert.org/fixbuf/libfixbuf/public_8h.html#aa939fd9269e4cf11317aa8ff9fc48224>(fbuf,
> fbInfoModelGetElementByName
> <https://tools.netsa.cert.org/fixbuf/libfixbuf/public_8h.html#a5dc8b2e255bc36ca22abbb811bf85c20>(infoModel,
> "myNewElement"), tid, err);
> It gets just one template id and call fbSessionAddTemplate()
> <https://tools.netsa.cert.org/fixbuf/libfixbuf/public_8h.html#a2e4baf6d2142eca4cb526b1e80628bf8>
> and  fBufSetExportTemplate()
> <https://tools.netsa.cert.org/fixbuf/libfixbuf/public_8h.html#af6cd20b1eb9a3287f17587888ee2476b>
> with this parameter. But we need two different template ids: internal
> template id and external template id...
> What should i do ?

It's been a while since I have worked with this API, but the
documentation on the page you reference says that you allocate the info
element options template using fbInfoElemntAllocTypeTemplate(), and then
you can register it using fbSessionAddTemplate().  This function can
take FB_TID_AUTO as its tid argument, and will return the actual
template ID assigned.  You would call this twice, once as internal, and
once as external.  Set the fbuf's internal and external templates to
these IDs (using fBufSet{Internal,External}Template(), and then call
fbInfoElementWriteOptionsRecord, almost certainly using the internal
template ID as the tid argument.

-- 
Michael Welsh Duggan
(mwd at cert.org)


More information about the netsa-tools-discuss mailing list