[Bro] Record problem...
Navdeep Singh
navdeepsuri13 at gmail.com
Mon Aug 3 23:14:02 PDT 2009
Hi Robin
Thanks for your help. I have got my mistake and what I wanted to do is done
but now I come to you point that
local id: con;
local id2: con2;
id2 = id;
is not right but it is "WORKING". Actaully read the following line is
documentaion in reference manual under *Record Assignment*:
In order to produce a *deep* copy, use the clone operator copy(). For more
details, see Expressions<http://www.bro-ids.org/wiki/index.php/Reference_Manual:_Statements_and_Expressions#Expressions>.
*You can also assign to a record another record that has fields with the
same names and types, even if they come in a different order*.
So I have noticed that even if *record types are different* but the *filed
names* and *types* inside these records are *same* then also *we can assign
*them to each other.
copy paste the following and see the output:
type con: record
{
orig_h: addr;
};
type con2: record
{
orig_h: addr;
};
function fun()
{
local id: con;
local id2: con2;
id=id2;
}
fun();
Regards
Navdeep
On Sat, Aug 1, 2009 at 7:07 PM, Navdeep Singh <navdeepsuri13 at gmail.com>wrote:
> Hi
> I am new to bro but really interested working in bro. I have already
> started the work. I am encountering a problem now.
> It is about records. Let me explain wid the help of example:
>
> type con: record
> {
> orig_h: addr;
> orig_p: port;
> resp_h: addr;
> resp_p: port;
> };
>
> type con2: record
> {
>
> orig_h: addr;
> orig_p: port;
> resp_h: addr;
> resp_p: port;
> num_notices: count &optional;
> };
>
> function fun()
> {
> local id: con;
> local id2: con2;
> id2 = id;
> }
>
> This is giving segmentation fault , the statement id2=id. But in
> documentation of bro , they have said this is absolutely right. Please
> explain this.
>
>
> Regards
> Navdeep
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ICSI.Berkeley.EDU/pipermail/bro/attachments/20090804/f0037030/attachment.html
More information about the Bro
mailing list