Fixes to plugin quick start doc.

BIT-1261 #close
This commit is contained in:
Jon Siwek 2014-09-24 10:04:09 -05:00
parent dae80fc119
commit 623896dd20

View file

@ -57,10 +57,10 @@ called ``Demo::Rot13``.
The ``init-plugin`` script puts a number of files in place. The full The ``init-plugin`` script puts a number of files in place. The full
layout is described later. For now, all we need is layout is described later. For now, all we need is
``src/functions.bif``. It's initially empty, but we'll add our new bif ``src/rot13.bif``. It's initially empty, but we'll add our new bif
there as follows:: there as follows::
# cat scripts/functions.bif # cat src/rot13.bif
module CaesarCipher; module CaesarCipher;
function rot13%(s: string%) : string function rot13%(s: string%) : string
@ -73,17 +73,19 @@ there as follows::
*p = (*p - b + 13) % 26 + b; *p = (*p - b + 13) % 26 + b;
} }
return new StringVal(new BroString(1, rot13, strlen(rot13))); BroString* bs = new BroString(1, reinterpret_cast<byte_vec>(rot13),
strlen(rot13));
return new StringVal(bs);
%} %}
The syntax of this file is just like any other ``*.bif`` file; we The syntax of this file is just like any other ``*.bif`` file; we
won't go into it here. won't go into it here.
Now we can already compile our plugin, we just need to tell the Now we can already compile our plugin, we just need to tell the
Makefile put in place by ``init-plugin`` where the Bro source tree is configure script put in place by ``init-plugin`` where the Bro source
located (Bro needs to have been built there first):: tree is located (Bro needs to have been built there first)::
# make BRO=/path/to/bro/dist # ./configure --bro-dist=/path/to/bro/dist && make
[... cmake output ...] [... cmake output ...]
Now our ``rot13-plugin`` directory has everything that it needs Now our ``rot13-plugin`` directory has everything that it needs