Hui Lin_Merging DNP3 analyzer

Hi, Robin,

I think the DNP3 analyzer is ready to be merged. The only concern now is that I still left very little Debug codes. Do u want me to remove them all?

I don’t have a tracker account. Can you create a ticket for me and give me a basic idea how to do the merging?

Best,

Hui

I think the DNP3 analyzer is ready to be merged. The only concern now is
that I still left very little Debug codes. Do u want me to remove them all?

Yes, generally, that should probably be removed. Take a look at the
DBG_LOG macro though (if you aren't already using it), it it's a good
way to keep some debugging information in.

I don't have a tracker account. Can you create a ticket for me and give me
a basic idea how to do the merging?

I'll do the merging; once you're ready just create a ticket and set it
to merge request. I'll create you an account on the tracker tomorrow.

However, as this is something for Bro 2.2, it'll take a bit until I'll
do the merge; we're in feature freeze mode right now. :slight_smile:

Robin

Hi, Robin,

Another two questions:

  1. I have some customization codes in DNP3.cc. I simply printf the error message in this file (such as memory allocation failed). For those error messages, do I have to include them in log files ?

  2. where should I put several sample policy files?

Best,

Hui

Hui, what's the branch your most recent code is in?

1. I have some customization codes in DNP3.cc. I simply printf the error
message in this file (such as memory allocation failed). For those error
messages, do I have to include them in log files ?

Yes, you should use the reporter for errors. For memory in particular,
you don't need to check if you use "new" (because a handler for that
is installed), and there's safe_malloc etc. for the C-style functions
(see util.h)

2. where should I put several sample policy files?

Put them under scripts/policy/protocols/ for now, we can later see if
that's something we want to ship.

Robin

Hui, what’s the branch your most recent code is in?

I am working on the branch topic/hui/powergrid3
But I have not pushed my recent modifications.

  1. I have some customization codes in DNP3.cc. I simply printf the error
    message in this file (such as memory allocation failed). For those error
    messages, do I have to include them in log files ?

Yes, you should use the reporter for errors. For memory in particular,
you don’t need to check if you use “new” (because a handler for that
is installed), and there’s safe_malloc etc. for the C-style functions
(see util.h)

Do we have any macro for reporting errors? There are some other errors in addition to memory allocation.

I may need some time to replace that old malloc functiions with the safe ones.

  1. where should I put several sample policy files?

Put them under scripts/policy/protocols/ for now, we can later see if
that’s something we want to ship.

OK.
I also plan to add little explanations on those policies.

You can use the reporter, see reporter.h; in particular its Weird
methods if it's protocol weirdness.

Robin

Just found out by taking look at FTP analyzer. :slight_smile:

I am using reporter->Warnings though.