diff --git a/tools/binpac/patches/binpac-1.patch b/tools/binpac/patches/binpac-1.patch index ade4e41065..20ad9e3e3c 100644 --- a/tools/binpac/patches/binpac-1.patch +++ b/tools/binpac/patches/binpac-1.patch @@ -1,10 +1,10 @@ -diff -urN bro-1.2.1-orig/src/binpac/pac_expr.cc bro-1.2.1-ssl-binpac/src/binpac/pac_expr.cc ---- bro-1.2.1-orig/src/binpac/pac_expr.cc 2006-07-26 15:02:40.000000000 -0700 -+++ bro-1.2.1-ssl-binpac/src/binpac/pac_expr.cc 2007-05-04 14:31:11.728494000 -0700 -@@ -776,6 +776,27 @@ +diff -urN bro-1.2.1-orig/src/pac_expr.cc bro-1.2.1-ssl-binpac/src/pac_expr.cc +--- bro-1.2.1-orig/src/pac_expr.cc 2006-07-26 15:02:40.000000000 -0700 ++++ bro-1.2.1-ssl-binpac/src/pac_expr.cc 2007-05-04 14:31:11.728494000 -0700 +@@ -776,2 +776,2 @@ } break; - + + case EXPR_CALLARGS: + { + mhs = 0; diff --git a/tools/binpac/patches/binpac-2.patch b/tools/binpac/patches/binpac-2.patch index 378c33027a..fe946740c2 100644 --- a/tools/binpac/patches/binpac-2.patch +++ b/tools/binpac/patches/binpac-2.patch @@ -1,9 +1,9 @@ -diff -urN bro-1.2.1-orig/src/binpac/pac_expr.cc bro-1.2.1-ssl-binpac/src/binpac/pac_expr.cc ---- bro-1.2.1-orig/src/binpac/pac_expr.cc 2006-07-26 15:02:40.000000000 -0700 -+++ bro-1.2.1-ssl-binpac/src/binpac/pac_expr.cc 2007-05-04 14:31:11.728494000 -0700 +diff -urN bro-1.2.1-orig/src/pac_expr.cc bro-1.2.1-ssl-binpac/src/pac_expr.cc +--- bro-1.2.1-orig/src/pac_expr.cc 2006-07-26 15:02:40.000000000 -0700 ++++ bro-1.2.1-ssl-binpac/src/pac_expr.cc 2007-05-04 14:31:11.728494000 -0700 @@ -245,6 +245,12 @@ - out_cc->println("%s %s;", - val_type->DataTypeStr().c_str(), + out_cc->println("%s %s;", + val_type->DataTypeStr().c_str(), env->LValue(val_var)); + + // force evaluation of IDs appearing in case stmt @@ -12,12 +12,12 @@ diff -urN bro-1.2.1-orig/src/binpac/pac_expr.cc bro-1.2.1-ssl-binpac/src/binpac/ + (*i)->value()->ForceIDEval(out_cc, env); + out_cc->println("switch ( %s )", operand_[0]->EvalExpr(out_cc, env)); - + out_cc->inc_indent(); @@ -386,6 +392,49 @@ } } - + +void Expr::ForceIDEval(Output* out_cc, Env* env) + { + switch ( expr_type_ ) @@ -64,24 +64,24 @@ diff -urN bro-1.2.1-orig/src/binpac/pac_expr.cc bro-1.2.1-ssl-binpac/src/binpac/ const char* Expr::EvalExpr(Output* out_cc, Env* env) { GenEval(out_cc, env); -diff -urN bro-1.2.1-orig/src/binpac/pac_expr.h bro-1.2.1-ssl-binpac/src/binpac/pac_expr.h ---- bro-1.2.1-orig/src/binpac/pac_expr.h 2006-07-26 15:02:39.000000000 -0700 -+++ bro-1.2.1-ssl-binpac/src/binpac/pac_expr.h 2007-05-04 14:16:31.624287000 -0700 +diff -urN bro-1.2.1-orig/src/pac_expr.h bro-1.2.1-ssl-binpac/src/pac_expr.h +--- bro-1.2.1-orig/src/pac_expr.h 2006-07-26 15:02:39.000000000 -0700 ++++ bro-1.2.1-ssl-binpac/src/pac_expr.h 2007-05-04 14:16:31.624287000 -0700 @@ -56,6 +56,11 @@ // const char *EvalExpr(Output *out, Env *env); - + + // force evaulation of IDs contained in this expression; + // necessary with case expr and conditional let fields (&if) + // for correct parsing of fields + void ForceIDEval(Output *out_cc, Env *env); + - // Returns the set_* function of the expression. + // Returns the set_* function of the expression. // The expression must be of form ID or x.ID. string SetFunc(Output *out, Env *env); -diff -urN bro-1.2.1-orig/src/binpac/pac_let.cc bro-1.2.1-ssl-binpac/src/binpac/pac_let.cc ---- bro-1.2.1-orig/src/binpac/pac_let.cc 2006-07-26 15:02:39.000000000 -0700 -+++ bro-1.2.1-ssl-binpac/src/binpac/pac_let.cc 2007-05-04 15:32:09.695568000 -0700 +diff -urN bro-1.2.1-orig/src/pac_let.cc bro-1.2.1-ssl-binpac/src/pac_let.cc +--- bro-1.2.1-orig/src/pac_let.cc 2006-07-26 15:02:39.000000000 -0700 ++++ bro-1.2.1-ssl-binpac/src/pac_let.cc 2007-05-04 15:32:09.695568000 -0700 @@ -80,7 +80,12 @@ if ( type_->attr_if_expr() ) { @@ -92,6 +92,6 @@ diff -urN bro-1.2.1-orig/src/binpac/pac_let.cc bro-1.2.1-ssl-binpac/src/binpac/p + // force evaluation of IDs contained in this expr + expr()->ForceIDEval(out_cc, env); + - out_cc->println("if ( %s )", + out_cc->println("if ( %s )", env->RValue(type_->has_value_var())); out_cc->inc_indent(); diff --git a/tools/binpac/patches/binpac-3.patch b/tools/binpac/patches/binpac-3.patch index 9832a245b6..5b520d5e09 100644 --- a/tools/binpac/patches/binpac-3.patch +++ b/tools/binpac/patches/binpac-3.patch @@ -1,37 +1,37 @@ -diff -urN bro-1.2.1-orig/src/binpac/pac_let.cc bro-1.2.1-ssl-binpac/src/binpac/pac_let.cc ---- bro-1.2.1-orig/src/binpac/pac_let.cc 2006-07-26 15:02:39.000000000 -0700 -+++ bro-1.2.1-ssl-binpac/src/binpac/pac_let.cc 2007-05-04 15:32:09.695568000 -0700 +diff -urN bro-1.2.1-orig/src/pac_let.cc bro-1.2.1-ssl-binpac/src/pac_let.cc +--- bro-1.2.1-orig/src/pac_let.cc 2006-07-26 15:02:39.000000000 -0700 ++++ bro-1.2.1-ssl-binpac/src/pac_let.cc 2007-05-04 15:32:09.695568000 -0700 @@ -108,11 +108,6 @@ void LetField::GenEval(Output* out_cc, Env* env) { GenParseCode(out_cc, env); - if ( type_->attr_if_expr() ) - { -- out_cc->println("BINPAC_ASSERT(%s);", +- out_cc->println("BINPAC_ASSERT(%s);", - env->RValue(type_->has_value_var())); - } } - + LetDecl::LetDecl(ID *id, Type *type, Expr *expr) -diff -urN bro-1.2.1-orig/src/binpac/pac_type.cc bro-1.2.1-ssl-binpac/src/binpac/pac_type.cc ---- bro-1.2.1-orig/src/binpac/pac_type.cc 2006-07-26 15:02:40.000000000 -0700 -+++ bro-1.2.1-ssl-binpac/src/binpac/pac_type.cc 2007-05-24 10:56:42.140658000 -0700 +diff -urN bro-1.2.1-orig/src/pac_type.cc bro-1.2.1-ssl-binpac/src/pac_type.cc +--- bro-1.2.1-orig/src/pac_type.cc 2006-07-26 15:02:40.000000000 -0700 ++++ bro-1.2.1-ssl-binpac/src/pac_type.cc 2007-05-24 10:56:42.140658000 -0700 @@ -316,9 +316,15 @@ { if ( DefineValueVar() ) { -- out_h->println("%s %s const { return %s; }", -- DataTypeConstRefStr().c_str(), +- out_h->println("%s %s const { return %s; }", +- DataTypeConstRefStr().c_str(), - env->RValue(value_var()), lvalue()); + if ( attr_if_expr_ ) + out_h->println("%s %s const { BINPAC_ASSERT(%s); return %s; }", -+ DataTypeConstRefStr().c_str(), ++ DataTypeConstRefStr().c_str(), + env->RValue(value_var()), + env->RValue(has_value_var()), lvalue()); + else + out_h->println("%s %s const { return %s; }", -+ DataTypeConstRefStr().c_str(), ++ DataTypeConstRefStr().c_str(), + env->RValue(value_var()), lvalue()); } - + foreach (i, FieldList, fields_) diff --git a/tools/binpac/patches/binpac-4.patch b/tools/binpac/patches/binpac-4.patch index 560fb4051b..feb644fba3 100644 --- a/tools/binpac/patches/binpac-4.patch +++ b/tools/binpac/patches/binpac-4.patch @@ -1,12 +1,12 @@ -diff -urN bro-1.2.1-orig/src/binpac/pac_record.cc bro-1.2.1-ssl-binpac/src/binpac/pac_record.cc ---- bro-1.2.1-orig/src/binpac/pac_record.cc 2006-07-26 15:02:40.000000000 -0700 -+++ bro-1.2.1-ssl-binpac/src/binpac/pac_record.cc 2007-05-08 16:13:33.373850000 -0700 -@@ -123,7 +123,7 @@ - void RecordType::DoGenParseCode(Output* out_cc, Env* env, +diff -urN bro-1.2.1-orig/src/pac_record.cc bro-1.2.1-ssl-binpac/src/pac_record.cc +--- bro-1.2.1-orig/src/pac_record.cc 2006-07-26 15:02:40.000000000 -0700 ++++ bro-1.2.1-ssl-binpac/src/pac_record.cc 2007-05-08 16:13:33.373850000 -0700 +@@ -123,5 +123,5 @@ + void RecordType::DoGenParseCode(Output* out_cc, Env* env, const DataPtr& data, int flags) { - if ( StaticSize(env) >= 0 ) + if ( !incremental_input() && StaticSize(env) >= 0 ) GenBoundaryCheck(out_cc, env, data); - + if ( incremental_parsing() ) diff --git a/tools/binpac/patches/binpac-5.patch b/tools/binpac/patches/binpac-5.patch index ae31fa1711..180c9fedf1 100644 --- a/tools/binpac/patches/binpac-5.patch +++ b/tools/binpac/patches/binpac-5.patch @@ -1,10 +1,10 @@ -diff -urN bro-1.2.1-orig/src/binpac/pac_paramtype.cc bro-1.2.1-ssl-binpac/src/binpac/pac_paramtype.cc ---- bro-1.2.1-orig/src/binpac/pac_paramtype.cc 2006-07-26 15:02:40.000000000 -0700 -+++ bro-1.2.1-ssl-binpac/src/binpac/pac_paramtype.cc 2007-05-10 15:09:47.470104000 -0700 +diff -urN bro-1.2.1-orig/src/pac_paramtype.cc bro-1.2.1-ssl-binpac/src/pac_paramtype.cc +--- bro-1.2.1-orig/src/pac_paramtype.cc 2006-07-26 15:02:40.000000000 -0700 ++++ bro-1.2.1-ssl-binpac/src/pac_paramtype.cc 2007-05-10 15:09:47.470104000 -0700 @@ -208,7 +208,13 @@ const char *parse_func; string parse_params; - + - if ( ref_type->incremental_input() ) + if ( buffer_mode() == BUFFER_NOTHING ) + { @@ -17,7 +17,7 @@ diff -urN bro-1.2.1-orig/src/binpac/pac_paramtype.cc bro-1.2.1-ssl-binpac/src/bi parse_func = kParseFuncWithBuffer; parse_params = env->RValue(flow_buffer_id); @@ -239,15 +245,24 @@ - + if ( incremental_input() ) { - ASSERT(parsing_complete_var()); @@ -32,7 +32,7 @@ diff -urN bro-1.2.1-orig/src/binpac/pac_paramtype.cc bro-1.2.1-ssl-binpac/src/bi + if ( buffer_mode() == BUFFER_NOTHING ) + { + out_cc->println("%s;", call_parse_func.c_str()); -+ out_cc->println("%s = true;", ++ out_cc->println("%s = true;", + env->LValue(parsing_complete_var())); + } + else @@ -50,14 +50,14 @@ diff -urN bro-1.2.1-orig/src/binpac/pac_paramtype.cc bro-1.2.1-ssl-binpac/src/bi } else { -diff -urN bro-1.2.1-orig/src/binpac/pac_type.cc bro-1.2.1-ssl-binpac/src/binpac/pac_type.cc ---- bro-1.2.1-orig/src/binpac/pac_type.cc 2006-07-26 15:02:40.000000000 -0700 -+++ bro-1.2.1-ssl-binpac/src/binpac/pac_type.cc 2007-05-24 10:56:42.140658000 -0700 +diff -urN bro-1.2.1-orig/src/pac_type.cc bro-1.2.1-ssl-binpac/src/pac_type.cc +--- bro-1.2.1-orig/src/pac_type.cc 2006-07-26 15:02:40.000000000 -0700 ++++ bro-1.2.1-ssl-binpac/src/pac_type.cc 2007-05-24 10:56:42.140658000 -0700 @@ -501,8 +501,8 @@ - + if ( buffer_mode() == BUFFER_NOTHING ) { -- out_cc->println("%s = true;", +- out_cc->println("%s = true;", - env->LValue(parsing_complete_var())); + // this is the empty type + DoGenParseCode(out_cc, env, data, flags); diff --git a/tools/binpac/patches/binpac-6.patch b/tools/binpac/patches/binpac-6.patch index fec16c1084..9b13a1cef5 100644 --- a/tools/binpac/patches/binpac-6.patch +++ b/tools/binpac/patches/binpac-6.patch @@ -1,10 +1,10 @@ -diff -urN bro-1.2.1-orig/src/binpac/lib/binpac_buffer.h bro-1.2.1-ssl-binpac/src/binpac/lib/binpac_buffer.h ---- bro-1.2.1-orig/src/binpac/lib/binpac_buffer.h 2006-07-26 15:02:38.000000000 -0700 -+++ bro-1.2.1-ssl-binpac/src/binpac/lib/binpac_buffer.h 2007-05-09 16:14:54.501656000 -0700 +diff -urN bro-1.2.1-orig/src/lib/binpac_buffer.h bro-1.2.1-ssl-binpac/src/lib/binpac_buffer.h +--- bro-1.2.1-orig/src/lib/binpac_buffer.h 2006-07-26 15:02:38.000000000 -0700 ++++ bro-1.2.1-ssl-binpac/src/lib/binpac_buffer.h 2007-05-09 16:14:54.501656000 -0700 @@ -59,6 +59,11 @@ return frame_length_; } - + + inline bool data_available() const + { + return buffer_n_ > 0 || orig_data_end_ > orig_data_begin_; @@ -13,16 +13,15 @@ diff -urN bro-1.2.1-orig/src/binpac/lib/binpac_buffer.h bro-1.2.1-ssl-binpac/src void NewLine(); // A negative frame_length represents a frame till EOF void NewFrame(int frame_length, bool chunked_); -diff -urN bro-1.2.1-orig/src/binpac/pac_flow.cc bro-1.2.1-ssl-binpac/src/binpac/pac_flow.cc ---- bro-1.2.1-orig/src/binpac/pac_flow.cc 2006-10-12 14:13:12.000000000 -0700 -+++ bro-1.2.1-ssl-binpac/src/binpac/pac_flow.cc 2007-05-22 16:43:55.997562000 -0700 +diff -urN bro-1.2.1-orig/src/pac_flow.cc bro-1.2.1-ssl-binpac/src/pac_flow.cc +--- bro-1.2.1-orig/src/pac_flow.cc 2006-10-12 14:13:12.000000000 -0700 ++++ bro-1.2.1-ssl-binpac/src/pac_flow.cc 2007-05-22 16:43:55.997562000 -0700 @@ -272,7 +272,8 @@ - env_->RValue(begin_of_data), - env_->RValue(end_of_data)); - + env_->RValue(begin_of_data), + env_->RValue(end_of_data)); + - out_cc->println("while ( true )"); + out_cc->println("while ( %s->data_available() )", + env_->LValue(flow_buffer_id)); out_cc->inc_indent(); out_cc->println("{"); - diff --git a/tools/binpac/patches/binpac-7.patch b/tools/binpac/patches/binpac-7.patch index 263f00bf2c..96b79f2e10 100644 --- a/tools/binpac/patches/binpac-7.patch +++ b/tools/binpac/patches/binpac-7.patch @@ -1,9 +1,9 @@ -diff -urN bro-1.2.1-orig/src/binpac/pac_type.cc bro-1.2.1-ssl-binpac/src/binpac/pac_type.cc ---- bro-1.2.1-orig/src/binpac/pac_type.cc 2006-07-26 15:02:40.000000000 -0700 -+++ bro-1.2.1-ssl-binpac/src/binpac/pac_type.cc 2007-05-24 10:56:42.140658000 -0700 +diff -urN bro-1.2.1-orig/src/pac_type.cc bro-1.2.1-ssl-binpac/src/pac_type.cc +--- bro-1.2.1-orig/src/pac_type.cc 2006-07-26 15:02:40.000000000 -0700 ++++ bro-1.2.1-ssl-binpac/src/pac_type.cc 2007-05-24 10:56:42.140658000 -0700 @@ -393,7 +393,7 @@ break; - + case BUFFER_BY_LENGTH: - if ( buffering_state_var_field_ ) + if ( env->GetDataType(buffering_state_id) ) @@ -13,7 +13,7 @@ diff -urN bro-1.2.1-orig/src/binpac/pac_type.cc bro-1.2.1-ssl-binpac/src/binpac/ @@ -421,7 +421,7 @@ frame_buffer_arg.c_str(), attr_chunked() ? "true" : "false"); - + - if ( buffering_state_var_field_ ) + if ( env->GetDataType(buffering_state_id) ) { diff --git a/tools/binpac/patches/binpac-8.patch b/tools/binpac/patches/binpac-8.patch index b69a1676dd..f452027725 100644 --- a/tools/binpac/patches/binpac-8.patch +++ b/tools/binpac/patches/binpac-8.patch @@ -1,18 +1,18 @@ -diff -urN bro-1.2.1-orig/src/binpac/pac_analyzer.cc bro-1.2.1-ssl-binpac/src/binpac/pac_analyzer.cc ---- bro-1.2.1-orig/src/binpac/pac_analyzer.cc 2006-07-26 15:02:40.000000000 -0700 -+++ bro-1.2.1-ssl-binpac/src/binpac/pac_analyzer.cc 2007-05-22 17:00:10.091531000 -0700 +diff -urN bro-1.2.1-orig/src/pac_analyzer.cc bro-1.2.1-ssl-binpac/src/pac_analyzer.cc +--- bro-1.2.1-orig/src/pac_analyzer.cc 2006-07-26 15:02:40.000000000 -0700 ++++ bro-1.2.1-ssl-binpac/src/pac_analyzer.cc 2007-05-22 17:00:10.091531000 -0700 @@ -26,8 +26,9 @@ helpers_ = new AnalyzerHelperList(); functions_ = new FunctionList(); - + - constructor_helper_ = 0; - destructor_helper_ = 0; + constructor_helpers_ = new AnalyzerHelperList(); + destructor_helpers_ = new AnalyzerHelperList(); + eof_helpers_ = new AnalyzerHelperList(); - + SetAnalyzerContext(); - + @@ -41,6 +42,9 @@ delete_list(AnalyzerHelperList, helpers_); delete_list(FunctionList, functions_); @@ -21,13 +21,13 @@ diff -urN bro-1.2.1-orig/src/binpac/pac_analyzer.cc bro-1.2.1-ssl-binpac/src/bin + delete_list(AnalyzerHelperList, destructor_helpers_); + delete_list(AnalyzerHelperList, eof_helpers_); } - + void AnalyzerDecl::AddElements(AnalyzerElementList *elemlist) @@ -75,28 +79,20 @@ - AnalyzerHelper *helper_elem = + AnalyzerHelper *helper_elem = (AnalyzerHelper *) elem; - -- if ( helper_elem->helper_type() == + +- if ( helper_elem->helper_type() == - AnalyzerHelper::INIT_CODE) - { - if ( constructor_helper_ ) @@ -50,7 +50,7 @@ diff -urN bro-1.2.1-orig/src/binpac/pac_analyzer.cc bro-1.2.1-ssl-binpac/src/bin + default: + helpers_->push_back(helper_elem); } -- else if ( helper_elem->helper_type() == +- else if ( helper_elem->helper_type() == - AnalyzerHelper::CLEANUP_CODE) - { - if ( destructor_helper_ ) @@ -76,7 +76,7 @@ diff -urN bro-1.2.1-orig/src/binpac/pac_analyzer.cc bro-1.2.1-ssl-binpac/src/bin + (*i)->GenCode(0, out_cc, this); + } } - + void AnalyzerDecl::GenCleanUpCode(Output *out_cc) { TypeDecl::GenCleanUpCode(out_cc); @@ -87,7 +87,7 @@ diff -urN bro-1.2.1-orig/src/binpac/pac_analyzer.cc bro-1.2.1-ssl-binpac/src/bin + (*i)->GenCode(0, out_cc, this); + } } - + void AnalyzerDecl::GenStateVarDecls(Output *out_h) @@ -295,6 +295,7 @@ break; @@ -97,20 +97,20 @@ diff -urN bro-1.2.1-orig/src/binpac/pac_analyzer.cc bro-1.2.1-ssl-binpac/src/bin out = out_cc; break; } -diff -urN bro-1.2.1-orig/src/binpac/pac_analyzer.h bro-1.2.1-ssl-binpac/src/binpac/pac_analyzer.h ---- bro-1.2.1-orig/src/binpac/pac_analyzer.h 2006-07-26 15:02:39.000000000 -0700 -+++ bro-1.2.1-ssl-binpac/src/binpac/pac_analyzer.h 2007-05-22 16:32:08.397926000 -0700 +diff -urN bro-1.2.1-orig/src/pac_analyzer.h bro-1.2.1-ssl-binpac/src/pac_analyzer.h +--- bro-1.2.1-orig/src/pac_analyzer.h 2006-07-26 15:02:39.000000000 -0700 ++++ bro-1.2.1-ssl-binpac/src/pac_analyzer.h 2007-05-22 16:32:08.397926000 -0700 @@ -76,8 +76,9 @@ AnalyzerHelperList *helpers_; FunctionList *functions_; - + - AnalyzerHelper *constructor_helper_; - AnalyzerHelper *destructor_helper_; + AnalyzerHelperList *constructor_helpers_; + AnalyzerHelperList *destructor_helpers_; + AnalyzerHelperList *eof_helpers_; }; - + class AnalyzerElement : public Object @@ -117,6 +118,7 @@ MEMBER_DECLS, @@ -120,9 +120,9 @@ diff -urN bro-1.2.1-orig/src/binpac/pac_analyzer.h bro-1.2.1-ssl-binpac/src/binp }; AnalyzerHelper(Type helper_type, EmbeddedCode *code) : AnalyzerElement(HELPER), -diff -urN bro-1.2.1-orig/src/binpac/pac_conn.cc bro-1.2.1-ssl-binpac/src/binpac/pac_conn.cc ---- bro-1.2.1-orig/src/binpac/pac_conn.cc 2006-07-26 15:02:40.000000000 -0700 -+++ bro-1.2.1-ssl-binpac/src/binpac/pac_conn.cc 2007-05-22 16:42:35.406135000 -0700 +diff -urN bro-1.2.1-orig/src/pac_conn.cc bro-1.2.1-ssl-binpac/src/pac_conn.cc +--- bro-1.2.1-orig/src/pac_conn.cc 2006-07-26 15:02:40.000000000 -0700 ++++ bro-1.2.1-ssl-binpac/src/pac_conn.cc 2007-05-22 16:42:35.406135000 -0700 @@ -97,6 +97,12 @@ out_cc->println("%s->%s();", env_->LValue(downflow_id), @@ -134,15 +134,15 @@ diff -urN bro-1.2.1-orig/src/binpac/pac_conn.cc bro-1.2.1-ssl-binpac/src/binpac/ + } + out_cc->dec_indent(); - + out_cc->println("}"); -diff -urN bro-1.2.1-orig/src/binpac/pac_flow.cc bro-1.2.1-ssl-binpac/src/binpac/pac_flow.cc ---- bro-1.2.1-orig/src/binpac/pac_flow.cc 2006-10-12 14:13:12.000000000 -0700 -+++ bro-1.2.1-ssl-binpac/src/binpac/pac_flow.cc 2007-05-22 16:43:55.997562000 -0700 +diff -urN bro-1.2.1-orig/src/pac_flow.cc bro-1.2.1-ssl-binpac/src/pac_flow.cc +--- bro-1.2.1-orig/src/pac_flow.cc 2006-10-12 14:13:12.000000000 -0700 ++++ bro-1.2.1-ssl-binpac/src/pac_flow.cc 2007-05-22 16:43:55.997562000 -0700 @@ -151,6 +151,11 @@ out_cc->inc_indent(); out_cc->println("{"); - + + foreach(i, AnalyzerHelperList, eof_helpers_) + { + (*i)->GenCode(0, out_cc, this); @@ -150,19 +150,19 @@ diff -urN bro-1.2.1-orig/src/binpac/pac_flow.cc bro-1.2.1-ssl-binpac/src/binpac/ + if ( dataunit_->type() == AnalyzerDataUnit::FLOWUNIT ) { - out_cc->println("%s->set_eof();", -diff -urN bro-1.2.1-orig/src/binpac/pac_parse.yy bro-1.2.1-ssl-binpac/src/binpac/pac_parse.yy ---- bro-1.2.1-orig/src/binpac/pac_parse.yy 2006-10-12 14:13:12.000000000 -0700 -+++ bro-1.2.1-ssl-binpac/src/binpac/pac_parse.yy 2007-05-22 16:56:09.280526000 -0700 + out_cc->println("%s->set_eof();", +diff -urN bro-1.2.1-orig/src/pac_parse.yy bro-1.2.1-ssl-binpac/src/pac_parse.yy +--- bro-1.2.1-orig/src/pac_parse.yy 2006-10-12 14:13:12.000000000 -0700 ++++ bro-1.2.1-ssl-binpac/src/pac_parse.yy 2007-05-22 16:56:09.280526000 -0700 @@ -22,7 +22,7 @@ - %token TOK_STATE TOK_ACTION TOK_WHEN TOK_HELPER + %token TOK_STATE TOK_ACTION TOK_WHEN TOK_HELPER %token TOK_DATAUNIT TOK_FLOWDIR TOK_WITHCONTEXT - %token TOK_LPB_EXTERN TOK_LPB_HEADER TOK_LPB_CODE --%token TOK_LPB_MEMBER TOK_LPB_INIT TOK_LPB_CLEANUP + %token TOK_LPB_EXTERN TOK_LPB_HEADER TOK_LPB_CODE +-%token TOK_LPB_MEMBER TOK_LPB_INIT TOK_LPB_CLEANUP +%token TOK_LPB_MEMBER TOK_LPB_INIT TOK_LPB_CLEANUP TOK_LPB_EOF - %token TOK_LPB TOK_RPB + %token TOK_LPB TOK_RPB %token TOK_EMBEDDED_ATOM TOK_EMBEDDED_STRING - %token TOK_PAC_VAL TOK_PAC_SET TOK_PAC_TYPE TOK_PAC_TYPEOF TOK_PAC_CONST_DEF + %token TOK_PAC_VAL TOK_PAC_SET TOK_PAC_TYPE TOK_PAC_TYPEOF TOK_PAC_CONST_DEF @@ -795,6 +795,10 @@ { $$ = new AnalyzerHelper(AnalyzerHelper::CLEANUP_CODE, $2); @@ -174,9 +174,9 @@ diff -urN bro-1.2.1-orig/src/binpac/pac_parse.yy bro-1.2.1-ssl-binpac/src/binpac | TOK_FLOWDIR '=' tok_id optargs ';' { $$ = new AnalyzerFlow((AnalyzerFlow::Direction) $1, $3, $4); -diff -urN bro-1.2.1-orig/src/binpac/pac_scan.ll bro-1.2.1-ssl-binpac/src/binpac/pac_scan.ll ---- bro-1.2.1-orig/src/binpac/pac_scan.ll 2006-07-26 15:02:40.000000000 -0700 -+++ bro-1.2.1-ssl-binpac/src/binpac/pac_scan.ll 2007-05-22 16:55:19.349644000 -0700 +diff -urN bro-1.2.1-orig/src/pac_scan.ll bro-1.2.1-ssl-binpac/src/pac_scan.ll +--- bro-1.2.1-orig/src/pac_scan.ll 2006-07-26 15:02:40.000000000 -0700 ++++ bro-1.2.1-ssl-binpac/src/pac_scan.ll 2007-05-22 16:55:19.349644000 -0700 @@ -96,6 +96,10 @@ BEGIN(EC); return TOK_LPB_MEMBER; diff --git a/tools/binpac/patches/nadi-bittorrent.patch b/tools/binpac/patches/nadi-bittorrent.patch index 1ce6cc0313..de0b68311f 100644 --- a/tools/binpac/patches/nadi-bittorrent.patch +++ b/tools/binpac/patches/nadi-bittorrent.patch @@ -1,24 +1,24 @@ -Index: pac_type.h +Index: src/pac_type.h =================================================================== ---- pac_type.h (revision 4130) -+++ pac_type.h (working copy) +--- src/pac_type.h (revision 4130) ++++ src/pac_type.h (working copy) @@ -78,12 +78,6 @@ string EvalByteOrder(Output *out_cc, Env *env) const; - + virtual string EvalMember(const ID *member_id) const; -#if 0 - // member_env() is used for finding a member of the type. -- // Thus member_env() of a ParameterizedType should return +- // Thus member_env() of a ParameterizedType should return - // ReferredDataType()->env() - // virtual Env *member_env() const; -#endif - + // The variable defined by the type const ID *value_var() const { return value_var_; } @@ -223,6 +217,8 @@ - + virtual bool ByteOrderSensitive() const = 0; - + + bool NeedsBufferingStateVar() const; + void GenBufferingLoop(Output* out_cc, Env* env, int flags); @@ -30,19 +30,19 @@ Index: lib/binpac_buffer.h +++ lib/binpac_buffer.h (working copy) @@ -24,18 +24,18 @@ void DiscardData(); - + // Whether there is enough data for the frame - bool ready() const{ return message_complete_; } + bool ready() const{ return message_complete_ || mode_ == UNKNOWN_MODE; } - + inline const_byteptr begin() const { - BINPAC_ASSERT(message_complete_); + BINPAC_ASSERT(ready()); - return ( buffer_n_ == 0 ) ? + return ( buffer_n_ == 0 ) ? orig_data_begin_ : buffer_; } - + inline const_byteptr end() const { - BINPAC_ASSERT(message_complete_); @@ -50,25 +50,25 @@ Index: lib/binpac_buffer.h if ( buffer_n_ == 0 ) { BINPAC_ASSERT(frame_length_ >= 0); -Index: pac_type.cc +Index: src/pac_type.cc =================================================================== ---- pac_type.cc (revision 4130) -+++ pac_type.cc (working copy) +--- src/pac_type.cc (revision 4130) ++++ src/pac_type.cc (working copy) @@ -285,9 +285,8 @@ parsing_complete_var, extern_type_bool->Clone()); parsing_complete_var_field_->Prepare(env); - + - if ( ( buffer_mode() == BUFFER_BY_LENGTH || - buffer_mode() == BUFFER_BY_LINE ) && - ! env->GetDataType(buffering_state_id) ) -+ if ( NeedsBufferingStateVar() && ++ if ( NeedsBufferingStateVar() && + !env->GetDataType(buffering_state_id) ) { buffering_state_var_field_ = new PrivVarField( - buffering_state_id->clone(), + buffering_state_id->clone(), @@ -387,17 +386,17 @@ break; - + case BUFFER_BY_LENGTH: - if ( buffering_state_var_field_ ) - { @@ -79,7 +79,7 @@ Index: pac_type.cc - } + if ( !NeedsBufferingStateVar() ) + break; - + + ASSERT(env->GetDataType(buffering_state_id)); + out_cc->println("if ( %s == 0 )", + env->RValue(buffering_state_id)); @@ -99,12 +99,12 @@ Index: pac_type.cc - frame_buffer_arg = strfmt("%d", InitialBufferLength()); + ASSERT(0); } - + out_cc->println("%s->NewFrame(%s, %s);", @@ -415,16 +414,14 @@ frame_buffer_arg.c_str(), attr_chunked() ? "true" : "false"); - + - if ( buffering_state_var_field_ ) - { - out_cc->println("%s = 1;", @@ -117,16 +117,16 @@ Index: pac_type.cc + out_cc->println("}"); + out_cc->dec_indent(); break; - + case BUFFER_BY_LINE: + ASSERT(env->GetDataType(buffering_state_id)); out_cc->println("if ( %s == 0 )", env->RValue(buffering_state_id)); out_cc->inc_indent(); @@ -890,6 +887,25 @@ - return ! attr_byteorder_expr() && ByteOrderSensitive(); + return ! attr_byteorder_expr() && ByteOrderSensitive(); } - + +bool Type::NeedsBufferingStateVar() const + { + if ( !incremental_input() ) @@ -149,10 +149,10 @@ Index: pac_type.cc bool Type::DoTraverse(DataDepVisitor *visitor) { foreach (i, FieldList, fields_) -Index: pac_flow.cc +Index: src/pac_flow.cc =================================================================== ---- pac_flow.cc (revision 4130) -+++ pac_flow.cc (working copy) +--- src/pac_flow.cc (revision 4130) ++++ src/pac_flow.cc (working copy) @@ -224,15 +224,13 @@ out_cc->println("catch ( Exception const &e )"); out_cc->inc_indent(); @@ -169,4 +169,3 @@ Index: pac_flow.cc + out_cc->println("throw e;"); out_cc->println("}"); out_cc->dec_indent(); -