]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
App Layer: cleanup state func naming
authorVictor Julien <victor@inliniac.net>
Thu, 9 Jan 2014 10:06:59 +0000 (11:06 +0100)
committerVictor Julien <victor@inliniac.net>
Fri, 10 Jan 2014 10:53:41 +0000 (11:53 +0100)
Rename functions related to AppLayerState to be more consistent.

src/app-layer-htp.c
src/app-layer-parser.c
src/app-layer-parser.h
src/app-layer-smtp.c
src/app-layer-ssl.c
src/detect.c
src/flow.c
src/log-httplog.c

index ca793007a1a102d963139ca1ad52d6b0795887fd..cfd063a530320beea02d3502657423da219947e2 100644 (file)
@@ -720,7 +720,7 @@ static int HTPHandleRequestData(Flow *f, void *htp_state,
     HTPHandleError(hstate);
 
     /* if the TCP connection is closed, then close the HTTP connection */
-    if (AppLayerParserParserStateIssetFlag(pstate, APP_LAYER_PARSER_EOF) &&
+    if (AppLayerParserStateIssetFlag(pstate, APP_LAYER_PARSER_EOF) &&
         !(hstate->flags & HTP_FLAG_STATE_CLOSED_TS))
     {
         htp_connp_close(hstate->connp, &ts);
@@ -796,7 +796,7 @@ static int HTPHandleResponseData(Flow *f, void *htp_state,
      }
 
     /* if we the TCP connection is closed, then close the HTTP connection */
-    if (AppLayerParserParserStateIssetFlag(pstate, APP_LAYER_PARSER_EOF) &&
+    if (AppLayerParserStateIssetFlag(pstate, APP_LAYER_PARSER_EOF) &&
         !(hstate->flags & HTP_FLAG_STATE_CLOSED_TC))
     {
         htp_connp_close(hstate->connp, &ts);
@@ -5517,7 +5517,7 @@ static int HTPBodyReassemblyTest01(void)
     memset(&hstate, 0x00, sizeof(hstate));
     Flow flow;
     memset(&flow, 0x00, sizeof(flow));
-    void *parser = AppLayerParserAllocAppLayerParserParserState();
+    void *parser = AppLayerParserStateAlloc();
     memset(&parser, 0x00, sizeof(parser));
     htp_tx_t tx;
     memset(&tx, 0, sizeof(tx));
index 7b9e96f0c4ec16ff77ce77e4902b4df95f7a4f41..b3df7dba7e955aac051f75b959510817475c3719 100644 (file)
@@ -170,7 +170,7 @@ static void AppLayerParserTransactionsCleanup(uint16_t ipproto, AppProto alproto
     SCReturn;
 }
 
-void *AppLayerParserAllocAppLayerParserParserState(void)
+void *AppLayerParserStateAlloc(void)
 {
     SCEnter();
 
@@ -183,7 +183,7 @@ void *AppLayerParserAllocAppLayerParserParserState(void)
     SCReturnPtr(pstate, "pstate");
 }
 
-void AppLayerParserDeAllocAppLayerParserParserState(void *pstate)
+void AppLayerParserStateFree(void *pstate)
 {
     SCEnter();
 
@@ -725,7 +725,7 @@ int AppLayerParserParse(void *tctx, Flow *f, AppProto alproto,
     /* Get the parser state (if any) */
     pstate = f->alparser;
     if (pstate == NULL) {
-        f->alparser = pstate = AppLayerParserAllocAppLayerParserParserState();
+        f->alparser = pstate = AppLayerParserStateAlloc();
         if (pstate == NULL)
             goto error;
     }
@@ -734,7 +734,7 @@ int AppLayerParserParse(void *tctx, Flow *f, AppProto alproto,
                pstate->version);
 
     if (flags & STREAM_EOF)
-        AppLayerParserParserStateSetFlag(pstate, APP_LAYER_PARSER_EOF);
+        AppLayerParserStateSetFlag(pstate, APP_LAYER_PARSER_EOF);
 
     alstate = f->alstate;
     if (alstate == NULL) {
@@ -802,7 +802,7 @@ void AppLayerParserSetEOF(void *pstate)
     if (pstate == NULL)
         goto end;
 
-    AppLayerParserParserStateSetFlag(pstate, APP_LAYER_PARSER_EOF);
+    AppLayerParserStateSetFlag(pstate, APP_LAYER_PARSER_EOF);
     /* increase version so we will inspect it one more time
      * with the EOF flags now set */
     ((AppLayerParserState *)pstate)->version++;
@@ -883,7 +883,7 @@ void AppLayerParserTriggerRawStreamReassembly(Flow *f)
 
 /***** Cleanup *****/
 
-void AppLayerParserCleanupParserState(uint16_t ipproto, AppProto alproto, void *alstate, void *pstate)
+void AppLayerParserStateCleanup(uint16_t ipproto, AppProto alproto, void *alstate, void *pstate)
 {
     SCEnter();
 
@@ -894,7 +894,7 @@ void AppLayerParserCleanupParserState(uint16_t ipproto, AppProto alproto, void *
 
     /* free the app layer parser api state */
     if (pstate != NULL)
-        AppLayerParserDeAllocAppLayerParserParserState(pstate);
+        AppLayerParserStateFree(pstate);
 
     SCReturn;
 }
@@ -955,14 +955,14 @@ void AppLayerParserRegisterProtocolParsers(void)
 }
 
 
-void AppLayerParserParserStateSetFlag(void *pstate, uint8_t flag)
+void AppLayerParserStateSetFlag(void *pstate, uint8_t flag)
 {
     SCEnter();
     ((AppLayerParserState *)pstate)->flags |= flag;
     SCReturn;
 }
 
-int AppLayerParserParserStateIssetFlag(void *pstate, uint8_t flag)
+int AppLayerParserStateIssetFlag(void *pstate, uint8_t flag)
 {
     SCEnter();
     SCReturnInt(((AppLayerParserState *)pstate)->flags & flag);
@@ -982,7 +982,7 @@ void AppLayerParserStreamTruncated(uint16_t ipproto, AppProto alproto, void *als
 }
 
 #ifdef DEBUG
-void AppLayerParserPrintDetailsParserState(void *pstate)
+void AppLayerParserStatePrintDetails(void *pstate)
 {
     SCEnter();
 
index 5025763a0a0ed22f7fade75a3344ee603d71ce03..af8016730d802f748db3eee47f187275822a6daf 100644 (file)
@@ -157,26 +157,26 @@ void AppLayerParserTriggerRawStreamReassembly(Flow *f);
 
 /***** Cleanup *****/
 
-void AppLayerParserCleanupParserState(uint16_t ipproto, AppProto alproto, void *alstate, void *pstate);
+void AppLayerParserStateCleanup(uint16_t ipproto, AppProto alproto, void *alstate, void *pstate);
 
 void AppLayerParserRegisterProtocolParsers(void);
 
 
-void AppLayerParserParserStateSetFlag(void *pstate, uint8_t flag);
-int AppLayerParserParserStateIssetFlag(void *pstate, uint8_t flag);
+void AppLayerParserStateSetFlag(void *pstate, uint8_t flag);
+int AppLayerParserStateIssetFlag(void *pstate, uint8_t flag);
 
 void AppLayerParserStreamTruncated(uint16_t ipproto, AppProto alproto, void *alstate,
                         uint8_t direction);
 
 
 
-void *AppLayerParserAllocAppLayerParserParserState(void);
-void AppLayerParserDeAllocAppLayerParserParserState(void *pstate);
+void *AppLayerParserStateAlloc(void);
+void AppLayerParserStateFree(void *pstate);
 
 
 
 #ifdef DEBUG
-void AppLayerParserPrintDetailsParserState(void *pstate);
+void AppLayerParserStatePrintDetails(void *pstate);
 #endif
 
 /***** Unittests *****/
index 6b0956c78a55dd8895a017cc9bd010c2beb0f7a5..cbc49ced8e513ee0475826251aaa200624f7d33c 100644 (file)
@@ -574,7 +574,7 @@ static int SMTPProcessReply(SMTPState *state, Flow *f,
         if (reply_code == SMTP_REPLY_220) {
             /* we are entering STARRTTLS data mode */
             state->parser_state |= SMTP_PARSER_STATE_COMMAND_DATA_MODE;
-            AppLayerParserParserStateSetFlag(pstate,
+            AppLayerParserStateSetFlag(pstate,
                                              APP_LAYER_PARSER_NO_INSPECTION |
                                              APP_LAYER_PARSER_NO_REASSEMBLY);
         } else {
index 19dbf22c5f6c016e91e186b9a5893918acc283ce..0196fb43493f266ca99f3d329a1cc964174a17b4 100644 (file)
@@ -643,10 +643,10 @@ static int SSLv2Decode(uint8_t direction, SSLState *ssl_state,
 
                 if ((ssl_state->flags & SSL_AL_FLAG_SSL_CLIENT_SSN_ENCRYPTED) &&
                     (ssl_state->flags & SSL_AL_FLAG_SSL_SERVER_SSN_ENCRYPTED)) {
-                    AppLayerParserParserStateSetFlag(pstate,
+                    AppLayerParserStateSetFlag(pstate,
                                                      APP_LAYER_PARSER_NO_INSPECTION);
                     if (ssl_config.no_reassemble == 1)
-                        AppLayerParserParserStateSetFlag(pstate, APP_LAYER_PARSER_NO_REASSEMBLY);
+                        AppLayerParserStateSetFlag(pstate, APP_LAYER_PARSER_NO_REASSEMBLY);
                     SCLogDebug("SSLv2 No reassembly & inspection has been set");
                 }
             }
@@ -718,9 +718,9 @@ static int SSLv3Decode(uint8_t direction, SSLState *ssl_state,
             if ((ssl_state->flags & SSL_AL_FLAG_CLIENT_CHANGE_CIPHER_SPEC) &&
                 (ssl_state->flags & SSL_AL_FLAG_SERVER_CHANGE_CIPHER_SPEC)) {
                 /* set flags */
-                AppLayerParserParserStateSetFlag(pstate, APP_LAYER_PARSER_NO_INSPECTION);
+                AppLayerParserStateSetFlag(pstate, APP_LAYER_PARSER_NO_INSPECTION);
                 if (ssl_config.no_reassemble == 1)
-                    AppLayerParserParserStateSetFlag(pstate, APP_LAYER_PARSER_NO_REASSEMBLY);
+                    AppLayerParserStateSetFlag(pstate, APP_LAYER_PARSER_NO_REASSEMBLY);
             }
 
             break;
@@ -3491,7 +3491,7 @@ static int SSLParserTest23(void)
         goto end;
     }
 
-    if (!AppLayerParserParserStateIssetFlag(f.alparser, APP_LAYER_PARSER_NO_INSPECTION) &&
+    if (!AppLayerParserStateIssetFlag(f.alparser, APP_LAYER_PARSER_NO_INSPECTION) &&
         !(ssn.client.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY) &&
         !(ssn.server.flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY)) {
         printf("The flags should be set\n");
index 678cf0c37cf24a0d30f4688a3310a0e65ecd4409..f16209b346654f08659e049d3dba71a5c1e2d2f2 100644 (file)
@@ -1006,7 +1006,7 @@ static void DebugInspectIds(Packet *p, Flow *f, StreamMsg *smsg)
                p->pcap_cnt, p->flowflags & FLOW_PKT_TOSERVER ? "toserver" : "toclient",
                p->flags & PKT_STREAM_EST ? "established" : "stateless",
                smsg ? "yes" : "no");
-    AppLayerParserPrintDetailsParserState(f->alparser);
+    AppLayerParserStatePrintDetails(f->alparser);
 }
 #endif
 
index 533b9802440afa0ccbc918441a580d237a031ab0..9f9e2bd4bd89a95a7a7ac27042f8cf4caf12d632 100644 (file)
@@ -97,7 +97,7 @@ void FlowCleanupAppLayer(Flow *f)
     if (f == NULL || f->proto == 0)
         return;
 
-    AppLayerParserCleanupParserState(f->proto, f->alproto, f->alstate, f->alparser);
+    AppLayerParserStateCleanup(f->proto, f->alproto, f->alstate, f->alparser);
     f->alstate = NULL;
     f->alparser = NULL;
     return;
index e8de1bdf14bc3a39be5a3a9db70a8773046ae991..48d860dad4e5b41b06626cc72f305de32a457417 100644 (file)
@@ -505,7 +505,7 @@ static TmEcode LogHttpLogIPWrapper(ThreadVars *tv, Packet *p, void *data, Packet
             continue;
         }
 
-        if (!AppLayerParserParserStateIssetFlag(p->flow->alparser, APP_LAYER_PARSER_EOF)) {
+        if (!AppLayerParserStateIssetFlag(p->flow->alparser, APP_LAYER_PARSER_EOF)) {
             tx_progress = AppLayerParserGetStateProgress(IPPROTO_TCP, ALPROTO_HTTP, tx, STREAM_TOSERVER);
             if (tx_progress < tx_progress_done_value_ts)
                 break;