]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Use u8 for ipproto
authorVictor Julien <victor@inliniac.net>
Thu, 9 Jan 2014 10:19:58 +0000 (11:19 +0100)
committerVictor Julien <victor@inliniac.net>
Fri, 10 Jan 2014 10:53:41 +0000 (11:53 +0100)
In a few places in app layer and unittests u16 was used.

src/app-layer-detect-proto.c
src/app-layer-detect-proto.h
src/app-layer-dns-common.c
src/app-layer-dns-common.h
src/app-layer-parser.c
src/app-layer-parser.h
src/detect-engine.c
src/detect-engine.h
src/util-unittest-helper.c
src/util-unittest-helper.h

index e2410d64bdefd51978a234ce3f5cbd9803a3a98c..8359e46fba45e643b8a6ce02a42cd099e51be421 100644 (file)
@@ -164,7 +164,7 @@ AppLayerProtoDetectCtx alpd_ctx;
 
 static uint16_t AppLayerProtoDetectPMMatchSignature(AppLayerProtoDetectPMSignature *s,
                                                     uint8_t *buf, uint16_t buflen,
-                                                    uint16_t ipproto)
+                                                    uint8_t ipproto)
 {
     SCEnter();
     uint16_t proto = ALPROTO_UNKNOWN;
@@ -937,7 +937,7 @@ static void AppLayerProtoDetectPMGetIpprotos(AppProto alproto,
     int pat_id, max_pat_id;
 
     int i, j;
-    uint16_t ipproto;
+    uint8_t ipproto;
 
     for (i = 0; i < FLOW_PROTO_DEFAULT; i++) {
         ipproto = FlowGetReverseProtoMapping(i);
@@ -1153,7 +1153,7 @@ static int AppLayerProtoDetectPMAddSignature(AppLayerProtoDetectPMCtx *ctx, Dete
     SCReturnInt(ret);
 }
 
-static int AppLayerProtoDetectPMRegisterPattern(uint16_t ipproto, uint16_t alproto,
+static int AppLayerProtoDetectPMRegisterPattern(uint8_t ipproto, uint16_t alproto,
                                                 char *pattern,
                                                 uint16_t depth, uint16_t offset,
                                                 uint8_t direction,
@@ -1284,7 +1284,7 @@ int AppLayerProtoDetectPrepareState(void)
 
 /***** PP registration *****/
 
-void AppLayerProtoDetectPPRegister(uint16_t ipproto,
+void AppLayerProtoDetectPPRegister(uint8_t ipproto,
                                    char *portstr,
                                    uint16_t alproto,
                                    uint16_t min_depth, uint16_t max_depth,
@@ -1317,7 +1317,7 @@ void AppLayerProtoDetectPPRegister(uint16_t ipproto,
 }
 
 void AppLayerProtoDetectPPParseConfPorts(const char *ipproto_name,
-                                         uint16_t ipproto,
+                                         uint8_t ipproto,
                                          const char *alproto_name,
                                          AppProto alproto,
                                          uint16_t min_depth, uint16_t max_depth,
@@ -1383,7 +1383,7 @@ void AppLayerProtoDetectPPParseConfPorts(const char *ipproto_name,
 
 /***** PM registration *****/
 
-int AppLayerProtoDetectPMRegisterPatternCS(uint16_t ipproto, AppProto alproto,
+int AppLayerProtoDetectPMRegisterPatternCS(uint8_t ipproto, AppProto alproto,
                                            char *pattern,
                                            uint16_t depth, uint16_t offset,
                                            uint8_t direction)
@@ -1396,7 +1396,7 @@ int AppLayerProtoDetectPMRegisterPatternCS(uint16_t ipproto, AppProto alproto,
                                                      1 /* case-sensitive */));
 }
 
-int AppLayerProtoDetectPMRegisterPatternCI(uint16_t ipproto, AppProto alproto,
+int AppLayerProtoDetectPMRegisterPatternCI(uint8_t ipproto, AppProto alproto,
                                            char *pattern,
                                            uint16_t depth, uint16_t offset,
                                            uint8_t direction)
index c3e6351d8d3d911aeaa555dc129efa273b117ba9..f3987cbfcb74df6c9f0c800ff6019e52ae3873bf 100644 (file)
@@ -58,14 +58,14 @@ int AppLayerProtoDetectPrepareState(void);
 
 /***** PP registration *****/
 
-void AppLayerProtoDetectPPRegister(uint16_t ipproto,
+void AppLayerProtoDetectPPRegister(uint8_t ipproto,
                                    char *portstr,
                                    AppProto alproto,
                                    uint16_t min_depth, uint16_t max_depth,
                                    uint8_t direction,
                                    ProbingParserFPtr ProbingParser);
 void AppLayerProtoDetectPPParseConfPorts(const char *ipproto_name,
-                                         uint16_t ipproto,
+                                         uint8_t ipproto,
                                          const char *alproto_name,
                                          AppProto alproto,
                                          uint16_t min_depth, uint16_t max_depth,
@@ -76,14 +76,14 @@ void AppLayerProtoDetectPPParseConfPorts(const char *ipproto_name,
 /**
  * \brief Registers a case-sensitive pattern for protocol detection.
  */
-int AppLayerProtoDetectPMRegisterPatternCS(uint16_t ipproto, AppProto alproto,
+int AppLayerProtoDetectPMRegisterPatternCS(uint8_t ipproto, AppProto alproto,
                                            char *pattern,
                                            uint16_t depth, uint16_t offset,
                                            uint8_t direction);
 /**
  * \brief Registers a case-insensitive pattern for protocol detection.
  */
-int AppLayerProtoDetectPMRegisterPatternCI(uint16_t ipproto, AppProto alproto,
+int AppLayerProtoDetectPMRegisterPatternCI(uint8_t ipproto, AppProto alproto,
                                            char *pattern,
                                            uint16_t depth, uint16_t offset,
                                            uint8_t direction);
index 40d3c59a4d779ce863c999967fc63da34c33f19f..28df0130e8ab12e62af3fdbece0a9757d908bd77 100644 (file)
@@ -69,7 +69,7 @@ int DNSStateGetEventInfo(const char *event_name,
     return 0;
 }
 
-void DNSAppLayerRegisterGetEventInfo(uint16_t ipproto, uint16_t alproto)
+void DNSAppLayerRegisterGetEventInfo(uint8_t ipproto, uint16_t alproto)
 {
     AppLayerParserRegisterGetEventInfo(ipproto, alproto, DNSStateGetEventInfo);
 
index 3a5bbeb6723fcc0bb1ef1d311d2351d852fb5c4b..6e42cf02f59572e60d525c35d492f29ec587bcda 100644 (file)
@@ -165,7 +165,7 @@ void DNSParserRegisterTests(void);
 void DNSAppLayerDecoderEventsRegister(int alproto);
 int DNSStateGetEventInfo(const char *event_name,
                          int *event_id, AppLayerEventType *event_type);
-void DNSAppLayerRegisterGetEventInfo(uint16_t ipproto, uint16_t alproto);
+void DNSAppLayerRegisterGetEventInfo(uint8_t ipproto, uint16_t alproto);
 
 void *DNSGetTx(void *alstate, uint64_t tx_id);
 uint64_t DNSGetTxCnt(void *alstate);
index b3df7dba7e955aac051f75b959510817475c3719..a791fa31ce17e06f57edaa5c026dfc6273375adb 100644 (file)
@@ -138,7 +138,7 @@ typedef struct AppLayerParserState_ {
  * Post 2.0 let's look at changing this to move it out to app-layer.c. */
 static AppLayerParserCtx alp_ctx;
 
-static void AppLayerParserTransactionsCleanup(uint16_t ipproto, AppProto alproto,
+static void AppLayerParserTransactionsCleanup(uint8_t ipproto, AppProto alproto,
                                               void *alstate, void *pstate)
 {
     SCEnter();
@@ -315,7 +315,7 @@ int AppLayerParserConfParserEnabled(const char *ipproto,
 
 /***** Parser related registration *****/
 
-int AppLayerParserRegisterParser(uint16_t ipproto, AppProto alproto,
+int AppLayerParserRegisterParser(uint8_t ipproto, AppProto alproto,
                       uint8_t direction,
                       int (*Parser)(Flow *f, void *protocol_state,
                                     void *pstate,
@@ -330,7 +330,7 @@ int AppLayerParserRegisterParser(uint16_t ipproto, AppProto alproto,
     SCReturnInt(0);
 }
 
-void AppLayerParserRegisterParserAcceptableDataDirection(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterParserAcceptableDataDirection(uint8_t ipproto, AppProto alproto,
                                               uint8_t direction)
 {
     SCEnter();
@@ -341,7 +341,7 @@ void AppLayerParserRegisterParserAcceptableDataDirection(uint16_t ipproto, AppPr
     SCReturn;
 }
 
-void AppLayerParserRegisterStateFuncs(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterStateFuncs(uint8_t ipproto, AppProto alproto,
                            void *(*StateAlloc)(void),
                            void (*StateFree)(void *))
 {
@@ -355,7 +355,7 @@ void AppLayerParserRegisterStateFuncs(uint16_t ipproto, AppProto alproto,
     SCReturn;
 }
 
-void AppLayerParserRegisterLocalStorageFunc(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterLocalStorageFunc(uint8_t ipproto, AppProto alproto,
                                  void *(*LocalStorageAlloc)(void),
                                  void (*LocalStorageFree)(void *))
 {
@@ -369,7 +369,7 @@ void AppLayerParserRegisterLocalStorageFunc(uint16_t ipproto, AppProto alproto,
     SCReturn;
 }
 
-void AppLayerParserRegisterGetFilesFunc(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterGetFilesFunc(uint8_t ipproto, AppProto alproto,
                              FileContainer *(*StateGetFiles)(void *, uint8_t))
 {
     SCEnter();
@@ -380,7 +380,7 @@ void AppLayerParserRegisterGetFilesFunc(uint16_t ipproto, AppProto alproto,
     SCReturn;
 }
 
-void AppLayerParserRegisterGetEventsFunc(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterGetEventsFunc(uint8_t ipproto, AppProto alproto,
     AppLayerDecoderEvents *(*StateGetEvents)(void *, uint64_t))
 {
     SCEnter();
@@ -391,7 +391,7 @@ void AppLayerParserRegisterGetEventsFunc(uint16_t ipproto, AppProto alproto,
     SCReturn;
 }
 
-void AppLayerParserRegisterHasEventsFunc(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterHasEventsFunc(uint8_t ipproto, AppProto alproto,
                               int (*StateHasEvents)(void *))
 {
     SCEnter();
@@ -402,7 +402,7 @@ void AppLayerParserRegisterHasEventsFunc(uint16_t ipproto, AppProto alproto,
     SCReturn;
 }
 
-void AppLayerParserRegisterLogger(uint16_t ipproto, AppProto alproto)
+void AppLayerParserRegisterLogger(uint8_t ipproto, AppProto alproto)
 {
     SCEnter();
 
@@ -411,7 +411,7 @@ void AppLayerParserRegisterLogger(uint16_t ipproto, AppProto alproto)
     SCReturn;
 }
 
-void AppLayerParserRegisterTruncateFunc(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterTruncateFunc(uint8_t ipproto, AppProto alproto,
                                         void (*Truncate)(void *, uint8_t))
 {
     SCEnter();
@@ -421,7 +421,7 @@ void AppLayerParserRegisterTruncateFunc(uint16_t ipproto, AppProto alproto,
     SCReturn;
 }
 
-void AppLayerParserRegisterGetStateProgressFunc(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterGetStateProgressFunc(uint8_t ipproto, AppProto alproto,
     int (*StateGetProgress)(void *alstate, uint8_t direction))
 {
     SCEnter();
@@ -432,7 +432,7 @@ void AppLayerParserRegisterGetStateProgressFunc(uint16_t ipproto, AppProto alpro
     SCReturn;
 }
 
-void AppLayerParserRegisterTxFreeFunc(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterTxFreeFunc(uint8_t ipproto, AppProto alproto,
                            void (*StateTransactionFree)(void *, uint64_t))
 {
     SCEnter();
@@ -443,7 +443,7 @@ void AppLayerParserRegisterTxFreeFunc(uint16_t ipproto, AppProto alproto,
     SCReturn;
 }
 
-void AppLayerParserRegisterGetTxCnt(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterGetTxCnt(uint8_t ipproto, AppProto alproto,
                          uint64_t (*StateGetTxCnt)(void *alstate))
 {
     SCEnter();
@@ -454,7 +454,7 @@ void AppLayerParserRegisterGetTxCnt(uint16_t ipproto, AppProto alproto,
     SCReturn;
 }
 
-void AppLayerParserRegisterGetTx(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterGetTx(uint8_t ipproto, AppProto alproto,
                       void *(StateGetTx)(void *alstate, uint64_t tx_id))
 {
     SCEnter();
@@ -465,7 +465,7 @@ void AppLayerParserRegisterGetTx(uint16_t ipproto, AppProto alproto,
     SCReturn;
 }
 
-void AppLayerParserRegisterGetStateProgressCompletionStatus(uint16_t ipproto,
+void AppLayerParserRegisterGetStateProgressCompletionStatus(uint8_t ipproto,
                                                    uint16_t alproto,
     int (*StateGetProgressCompletionStatus)(uint8_t direction))
 {
@@ -477,7 +477,7 @@ void AppLayerParserRegisterGetStateProgressCompletionStatus(uint16_t ipproto,
     SCReturn;
 }
 
-void AppLayerParserRegisterGetEventInfo(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterGetEventInfo(uint8_t ipproto, AppProto alproto,
     int (*StateGetEventInfo)(const char *event_name, int *event_id,
                              AppLayerEventType *event_type))
 {
@@ -491,7 +491,7 @@ void AppLayerParserRegisterGetEventInfo(uint16_t ipproto, AppProto alproto,
 
 /***** Get and transaction functions *****/
 
-void *AppLayerParserGetProtocolParserLocalStorage(uint16_t ipproto, AppProto alproto)
+void *AppLayerParserGetProtocolParserLocalStorage(uint8_t ipproto, AppProto alproto)
 {
     SCEnter();
 
@@ -505,7 +505,7 @@ void *AppLayerParserGetProtocolParserLocalStorage(uint16_t ipproto, AppProto alp
     SCReturnPtr(NULL, "void *");
 }
 
-void AppLayerParserDestroyProtocolParserLocalStorage(uint16_t ipproto, AppProto alproto,
+void AppLayerParserDestroyProtocolParserLocalStorage(uint8_t ipproto, AppProto alproto,
                                           void *local_data)
 {
     SCEnter();
@@ -545,7 +545,7 @@ uint64_t AppLayerParserGetTransactionInspectId(void *pstate, uint8_t direction)
 }
 
 void AppLayerParserSetTransactionInspectId(void *pstate,
-                                           uint16_t ipproto, AppProto alproto, void *alstate,
+                                           uint8_t ipproto, AppProto alproto, void *alstate,
                                            uint8_t direction)
 {
     SCEnter();
@@ -585,7 +585,7 @@ void AppLayerParserSetDecoderEvents(void *pstate, AppLayerDecoderEvents *devents
     (((AppLayerParserState *)pstate)->decoder_events) = devents;
 }
 
-AppLayerDecoderEvents *AppLayerParserGetEventsByTx(uint16_t ipproto, AppProto alproto,
+AppLayerDecoderEvents *AppLayerParserGetEventsByTx(uint8_t ipproto, AppProto alproto,
                                         void *alstate, uint64_t tx_id)
 {
     SCEnter();
@@ -609,7 +609,7 @@ uint16_t AppLayerParserGetStateVersion(void *pstate)
                "uint16_t");
 }
 
-FileContainer *AppLayerParserGetFiles(uint16_t ipproto, AppProto alproto,
+FileContainer *AppLayerParserGetFiles(uint8_t ipproto, AppProto alproto,
                            void *alstate, uint8_t direction)
 {
     SCEnter();
@@ -626,7 +626,7 @@ FileContainer *AppLayerParserGetFiles(uint16_t ipproto, AppProto alproto,
     SCReturnPtr(ptr, "FileContainer *");
 }
 
-int AppLayerParserGetStateProgress(uint16_t ipproto, AppProto alproto,
+int AppLayerParserGetStateProgress(uint8_t ipproto, AppProto alproto,
                         void *alstate, uint8_t direction)
 {
     SCEnter();
@@ -634,21 +634,21 @@ int AppLayerParserGetStateProgress(uint16_t ipproto, AppProto alproto,
                 StateGetProgress(alstate, direction));
 }
 
-uint64_t AppLayerParserGetTxCnt(uint16_t ipproto, AppProto alproto, void *alstate)
+uint64_t AppLayerParserGetTxCnt(uint8_t ipproto, AppProto alproto, void *alstate)
 {
     SCEnter();
     SCReturnCT(alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto].
                StateGetTxCnt(alstate), "uint64_t");
 }
 
-void *AppLayerParserGetTx(uint16_t ipproto, AppProto alproto, void *alstate, uint64_t tx_id)
+void *AppLayerParserGetTx(uint8_t ipproto, AppProto alproto, void *alstate, uint64_t tx_id)
 {
     SCEnter();
     SCReturnPtr(alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto].
                 StateGetTx(alstate, tx_id), "void *");
 }
 
-int AppLayerParserGetStateProgressCompletionStatus(uint16_t ipproto, AppProto alproto,
+int AppLayerParserGetStateProgressCompletionStatus(uint8_t ipproto, AppProto alproto,
                                         uint8_t direction)
 {
     SCEnter();
@@ -657,7 +657,7 @@ int AppLayerParserGetStateProgressCompletionStatus(uint16_t ipproto, AppProto al
 
 }
 
-int AppLayerParserGetEventInfo(uint16_t ipproto, AppProto alproto, const char *event_name,
+int AppLayerParserGetEventInfo(uint8_t ipproto, AppProto alproto, const char *event_name,
                     int *event_id, AppLayerEventType *event_type)
 {
     SCEnter();
@@ -667,14 +667,14 @@ int AppLayerParserGetEventInfo(uint16_t ipproto, AppProto alproto, const char *e
     SCReturnInt(r);
 }
 
-uint8_t AppLayerParserGetFirstDataDir(uint16_t ipproto, uint16_t alproto)
+uint8_t AppLayerParserGetFirstDataDir(uint8_t ipproto, uint16_t alproto)
 {
     SCEnter();
     SCReturnCT(alp_ctx.ctxs[FlowGetProtoMapping(ipproto)][alproto].
                first_data_dir, "uint8_t");
 }
 
-uint64_t AppLayerParserGetTransactionActive(uint16_t ipproto, AppProto alproto, void *pstate, uint8_t direction)
+uint64_t AppLayerParserGetTransactionActive(uint8_t ipproto, AppProto alproto, void *pstate, uint8_t direction)
 {
     SCEnter();
 
@@ -811,7 +811,7 @@ void AppLayerParserSetEOF(void *pstate)
     SCReturn;
 }
 
-int AppLayerParserHasDecoderEvents(uint16_t ipproto, AppProto alproto,
+int AppLayerParserHasDecoderEvents(uint8_t ipproto, AppProto alproto,
                                    void *alstate, void *pstate,
                                    uint8_t flags)
 {
@@ -855,7 +855,7 @@ int AppLayerParserHasDecoderEvents(uint16_t ipproto, AppProto alproto,
     SCReturnInt(1);
 }
 
-int AppLayerParserProtocolIsTxEventAware(uint16_t ipproto, AppProto alproto)
+int AppLayerParserProtocolIsTxEventAware(uint8_t ipproto, AppProto alproto)
 {
     SCEnter();
     int ipproto_map = FlowGetProtoMapping(ipproto);
@@ -863,7 +863,7 @@ int AppLayerParserProtocolIsTxEventAware(uint16_t ipproto, AppProto alproto)
     SCReturnInt(r);
 }
 
-int AppLayerParserProtocolSupportsTxs(uint16_t ipproto, AppProto alproto)
+int AppLayerParserProtocolSupportsTxs(uint8_t ipproto, AppProto alproto)
 {
     SCEnter();
     int ipproto_map = FlowGetProtoMapping(ipproto);
@@ -883,7 +883,7 @@ void AppLayerParserTriggerRawStreamReassembly(Flow *f)
 
 /***** Cleanup *****/
 
-void AppLayerParserStateCleanup(uint16_t ipproto, AppProto alproto, void *alstate, void *pstate)
+void AppLayerParserStateCleanup(uint8_t ipproto, AppProto alproto, void *alstate, void *pstate)
 {
     SCEnter();
 
@@ -969,7 +969,7 @@ int AppLayerParserStateIssetFlag(void *pstate, uint8_t flag)
 }
 
 
-void AppLayerParserStreamTruncated(uint16_t ipproto, AppProto alproto, void *alstate,
+void AppLayerParserStreamTruncated(uint8_t ipproto, AppProto alproto, void *alstate,
                                    uint8_t direction)
 {
     SCEnter();
@@ -1046,7 +1046,7 @@ static void TestProtocolStateFree(void *s)
     SCFree(s);
 }
 
-void AppLayerParserRegisterProtocolUnittests(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterProtocolUnittests(uint8_t ipproto, AppProto alproto,
                                   void (*RegisterUnittests)(void))
 {
     SCEnter();
index af8016730d802f748db3eee47f187275822a6daf..1b91329375b92c20468af21595e61c3dd862fc11 100644 (file)
@@ -72,49 +72,49 @@ int AppLayerParserConfParserEnabled(const char *ipproto,
  * \retval 0 On success.
  * \retval -1 On failure.
  */
-int AppLayerParserRegisterParser(uint16_t ip_proto, AppProto alproto,
+int AppLayerParserRegisterParser(uint8_t ipproto, AppProto alproto,
                       uint8_t direction,
                       int (*Parser)(Flow *f, void *protocol_state,
                                     void *pstate,
                                     uint8_t *buf, uint32_t buf_len,
                                     void *local_storage));
-void AppLayerParserRegisterParserAcceptableDataDirection(uint16_t ipproto,
+void AppLayerParserRegisterParserAcceptableDataDirection(uint8_t ipproto,
                                               AppProto alproto,
                                               uint8_t direction);
-void AppLayerParserRegisterStateFuncs(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterStateFuncs(uint8_t ipproto, AppProto alproto,
                            void *(*StateAlloc)(void),
                            void (*StateFree)(void *));
-void AppLayerParserRegisterLocalStorageFunc(uint16_t ipproto, AppProto proto,
+void AppLayerParserRegisterLocalStorageFunc(uint8_t ipproto, AppProto proto,
                                  void *(*LocalStorageAlloc)(void),
                                  void (*LocalStorageFree)(void *));
-void AppLayerParserRegisterGetFilesFunc(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterGetFilesFunc(uint8_t ipproto, AppProto alproto,
                              FileContainer *(*StateGetFiles)(void *, uint8_t));
-void AppLayerParserRegisterGetEventsFunc(uint16_t ipproto, AppProto proto,
+void AppLayerParserRegisterGetEventsFunc(uint8_t ipproto, AppProto proto,
     AppLayerDecoderEvents *(*StateGetEvents)(void *, uint64_t));
-void AppLayerParserRegisterHasEventsFunc(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterHasEventsFunc(uint8_t ipproto, AppProto alproto,
                               int (*StateHasEvents)(void *));
-void AppLayerParserRegisterLogger(uint16_t ipproto, AppProto alproto);
-void AppLayerParserRegisterTruncateFunc(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterLogger(uint8_t ipproto, AppProto alproto);
+void AppLayerParserRegisterTruncateFunc(uint8_t ipproto, AppProto alproto,
                              void (*Truncate)(void *, uint8_t));
-void AppLayerParserRegisterGetStateProgressFunc(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterGetStateProgressFunc(uint8_t ipproto, AppProto alproto,
     int (*StateGetStateProgress)(void *alstate, uint8_t direction));
-void AppLayerParserRegisterTxFreeFunc(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterTxFreeFunc(uint8_t ipproto, AppProto alproto,
                            void (*StateTransactionFree)(void *, uint64_t));
-void AppLayerParserRegisterGetTxCnt(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterGetTxCnt(uint8_t ipproto, AppProto alproto,
                          uint64_t (*StateGetTxCnt)(void *alstate));
-void AppLayerParserRegisterGetTx(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterGetTx(uint8_t ipproto, AppProto alproto,
                       void *(StateGetTx)(void *alstate, uint64_t tx_id));
-void AppLayerParserRegisterGetStateProgressCompletionStatus(uint16_t ipproto,
+void AppLayerParserRegisterGetStateProgressCompletionStatus(uint8_t ipproto,
                                                  uint16_t alproto,
     int (*StateGetStateProgressCompletionStatus)(uint8_t direction));
-void AppLayerParserRegisterGetEventInfo(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterGetEventInfo(uint8_t ipproto, AppProto alproto,
     int (*StateGetEventInfo)(const char *event_name, int *event_id,
                              AppLayerEventType *event_type));
 
 /***** Get and transaction functions *****/
 
-void *AppLayerParserGetProtocolParserLocalStorage(uint16_t ipproto, AppProto alproto);
-void AppLayerParserDestroyProtocolParserLocalStorage(uint16_t ipproto, AppProto alproto,
+void *AppLayerParserGetProtocolParserLocalStorage(uint8_t ipproto, AppProto alproto);
+void AppLayerParserDestroyProtocolParserLocalStorage(uint8_t ipproto, AppProto alproto,
                                           void *local_data);
 
 
@@ -122,42 +122,42 @@ uint64_t AppLayerParserGetTransactionLogId(void *pstate);
 void AppLayerParserSetTransactionLogId(void *pstate);
 uint64_t AppLayerParserGetTransactionInspectId(void *pstate, uint8_t direction);
 void AppLayerParserSetTransactionInspectId(void *pstate,
-                                uint16_t ipproto, AppProto alproto, void *alstate,
+                                uint8_t ipproto, AppProto alproto, void *alstate,
                                 uint8_t direction);
 AppLayerDecoderEvents *AppLayerParserGetDecoderEvents(void *pstate);
 void AppLayerParserSetDecoderEvents(void *pstate, AppLayerDecoderEvents *devents);
-AppLayerDecoderEvents *AppLayerParserGetEventsByTx(uint16_t ipproto, AppProto alproto, void *alstate,
+AppLayerDecoderEvents *AppLayerParserGetEventsByTx(uint8_t ipproto, AppProto alproto, void *alstate,
                                         uint64_t tx_id);
 uint16_t AppLayerParserGetStateVersion(void *pstate);
-FileContainer *AppLayerParserGetFiles(uint16_t ipproto, AppProto alproto,
+FileContainer *AppLayerParserGetFiles(uint8_t ipproto, AppProto alproto,
                            void *alstate, uint8_t direction);
-int AppLayerParserGetStateProgress(uint16_t ipproto, AppProto alproto,
+int AppLayerParserGetStateProgress(uint8_t ipproto, AppProto alproto,
                         void *alstate, uint8_t direction);
-uint64_t AppLayerParserGetTxCnt(uint16_t ipproto, AppProto alproto, void *alstate);
-void *AppLayerParserGetTx(uint16_t ipproto, AppProto alproto, void *alstate, uint64_t tx_id);
-int AppLayerParserGetStateProgressCompletionStatus(uint16_t ipproto, AppProto alproto,
+uint64_t AppLayerParserGetTxCnt(uint8_t ipproto, AppProto alproto, void *alstate);
+void *AppLayerParserGetTx(uint8_t ipproto, AppProto alproto, void *alstate, uint64_t tx_id);
+int AppLayerParserGetStateProgressCompletionStatus(uint8_t ipproto, AppProto alproto,
                                         uint8_t direction);
-int AppLayerParserGetEventInfo(uint16_t ipproto, AppProto alproto, const char *event_name,
+int AppLayerParserGetEventInfo(uint8_t ipproto, AppProto alproto, const char *event_name,
                     int *event_id, AppLayerEventType *event_type);
 
-uint64_t AppLayerParserGetTransactionActive(uint16_t ipproto, AppProto alproto, void *pstate, uint8_t direction);
+uint64_t AppLayerParserGetTransactionActive(uint8_t ipproto, AppProto alproto, void *pstate, uint8_t direction);
 
-uint8_t AppLayerParserGetFirstDataDir(uint16_t ipproto, uint16_t alproto);
+uint8_t AppLayerParserGetFirstDataDir(uint8_t ipproto, uint16_t alproto);
 
 /***** General *****/
 
 int AppLayerParserParse(void *tctx, Flow *f, AppProto alproto,
                    uint8_t flags, uint8_t *input, uint32_t input_len);
 void AppLayerParserSetEOF(void *pstate);
-int AppLayerParserHasDecoderEvents(uint16_t ipproto, AppProto alproto, void *alstate, void *pstate,
+int AppLayerParserHasDecoderEvents(uint8_t ipproto, AppProto alproto, void *alstate, void *pstate,
                         uint8_t flags);
-int AppLayerParserProtocolIsTxEventAware(uint16_t ipproto, AppProto alproto);
-int AppLayerParserProtocolSupportsTxs(uint16_t ipproto, AppProto alproto);
+int AppLayerParserProtocolIsTxEventAware(uint8_t ipproto, AppProto alproto);
+int AppLayerParserProtocolSupportsTxs(uint8_t ipproto, AppProto alproto);
 void AppLayerParserTriggerRawStreamReassembly(Flow *f);
 
 /***** Cleanup *****/
 
-void AppLayerParserStateCleanup(uint16_t ipproto, AppProto alproto, void *alstate, void *pstate);
+void AppLayerParserStateCleanup(uint8_t ipproto, AppProto alproto, void *alstate, void *pstate);
 
 void AppLayerParserRegisterProtocolParsers(void);
 
@@ -165,7 +165,7 @@ void AppLayerParserRegisterProtocolParsers(void);
 void AppLayerParserStateSetFlag(void *pstate, uint8_t flag);
 int AppLayerParserStateIssetFlag(void *pstate, uint8_t flag);
 
-void AppLayerParserStreamTruncated(uint16_t ipproto, AppProto alproto, void *alstate,
+void AppLayerParserStreamTruncated(uint8_t ipproto, AppProto alproto, void *alstate,
                         uint8_t direction);
 
 
@@ -182,7 +182,7 @@ void AppLayerParserStatePrintDetails(void *pstate);
 /***** Unittests *****/
 
 #ifdef UNITTESTS
-void AppLayerParserRegisterProtocolUnittests(uint16_t ipproto, AppProto alproto,
+void AppLayerParserRegisterProtocolUnittests(uint8_t ipproto, AppProto alproto,
                                   void (*RegisterUnittests)(void));
 void AppLayerParserRegisterUnittests(void);
 void AppLayerParserBackupParserTable(void);
index afbca5f54725b06e0a38b04346f199334f7dd3cb..d9de03a02a4a53753faf158eaf24c4ddd1b012cf 100644 (file)
@@ -136,7 +136,7 @@ static void DetectEnginePrintAppInspectionEngines(DetectEngineAppInspectionEngin
 void DetectEngineRegisterAppInspectionEngines(void)
 {
     struct tmp_t {
-        uint16_t ipproto;
+        uint8_t ipproto;
         uint16_t alproto;
         int32_t sm_list;
         uint32_t inspect_flags;
@@ -361,7 +361,7 @@ static void AppendAppInspectionEngine(DetectEngineAppInspectionEngine *engine,
     return;
 }
 
-void DetectEngineRegisterAppInspectionEngine(uint16_t ipproto,
+void DetectEngineRegisterAppInspectionEngine(uint8_t ipproto,
                                              uint16_t alproto,
                                              uint16_t dir,
                                              int32_t sm_list,
index e92dab56bd04ce9f361d7dae666f1fd47ac6a450..14008ea86025acf25d87908d95e6ea8b9d188c73 100644 (file)
@@ -29,7 +29,7 @@
 #include "flow-private.h"
 
 typedef struct DetectEngineAppInspectionEngine_ {
-    uint16_t ipproto;
+    uint8_t ipproto;
     uint16_t alproto;
     uint16_t dir;
 
@@ -81,7 +81,7 @@ const char *DetectSigmatchListEnumToString(enum DetectSigmatchListEnum type);
  *                    the inpsect_flags.
  * \param Callback The engine callback.
  */
-void DetectEngineRegisterAppInspectionEngine(uint16_t ipproto,
+void DetectEngineRegisterAppInspectionEngine(uint8_t ipproto,
                                              uint16_t alproto,
                                              uint16_t direction,
                                              int32_t sm_list,
index 64ae8c47baf7f807c6693b1e6655100e9ab329a3..bac2083e21615891105960292c63d0e99ff83e35 100644 (file)
@@ -75,7 +75,7 @@ uint32_t UTHSetIPv4Address(char *str) {
  * \retval Packet pointer to the built in packet
  */
 Packet *UTHBuildPacketIPV6Real(uint8_t *payload, uint16_t payload_len,
-                           uint16_t ipproto, char *src, char *dst,
+                           uint8_t ipproto, char *src, char *dst,
                            uint16_t sport, uint16_t dport) {
     uint32_t in[4];
 
@@ -160,7 +160,7 @@ error:
  * \retval Packet pointer to the built in packet
  */
 Packet *UTHBuildPacketReal(uint8_t *payload, uint16_t payload_len,
-                           uint16_t ipproto, char *src, char *dst,
+                           uint8_t ipproto, char *src, char *dst,
                            uint16_t sport, uint16_t dport) {
     struct in_addr in;
 
@@ -252,7 +252,7 @@ error:
  * \retval Packet pointer to the built in packet
  */
 Packet *UTHBuildPacket(uint8_t *payload, uint16_t payload_len,
-                           uint16_t ipproto) {
+                           uint8_t ipproto) {
     return UTHBuildPacketReal(payload, payload_len, ipproto,
                               "192.168.1.5", "192.168.1.1",
                               41424, 80);
@@ -330,7 +330,7 @@ Packet *UTHBuildPacketFromEth(uint8_t *raw_eth, uint16_t pktsize) {
  * \retval Packet pointer to the built in packet
  */
 Packet *UTHBuildPacketSrcDst(uint8_t *payload, uint16_t payload_len,
-                           uint16_t ipproto, char *src, char *dst) {
+                           uint8_t ipproto, char *src, char *dst) {
     return UTHBuildPacketReal(payload, payload_len, ipproto,
                               src, dst,
                               41424, 80);
@@ -347,7 +347,7 @@ Packet *UTHBuildPacketSrcDst(uint8_t *payload, uint16_t payload_len,
  * \retval Packet pointer to the built in packet
  */
 Packet *UTHBuildPacketIPV6SrcDst(uint8_t *payload, uint16_t payload_len,
-                           uint16_t ipproto, char *src, char *dst) {
+                           uint8_t ipproto, char *src, char *dst) {
     return UTHBuildPacketIPV6Real(payload, payload_len, ipproto,
                               src, dst,
                               41424, 80);
@@ -364,7 +364,7 @@ Packet *UTHBuildPacketIPV6SrcDst(uint8_t *payload, uint16_t payload_len,
  * \retval Packet pointer to the built in packet
  */
 Packet *UTHBuildPacketSrcDstPorts(uint8_t *payload, uint16_t payload_len,
-                           uint16_t ipproto, uint16_t sport, uint16_t dport) {
+                           uint8_t ipproto, uint16_t sport, uint16_t dport) {
     return UTHBuildPacketReal(payload, payload_len, ipproto,
                               "192.168.1.5", "192.168.1.1",
                               sport, dport);
@@ -849,7 +849,7 @@ uint32_t UTHBuildPacketOfFlows(uint32_t start, uint32_t end, uint8_t dir) {
 /**
  * \brief CheckUTHTestPacket wrapper to check packets for unittests
  */
-int CheckUTHTestPacket(Packet *p, uint16_t ipproto) {
+int CheckUTHTestPacket(Packet *p, uint8_t ipproto) {
     uint16_t sport = 41424;
     uint16_t dport = 80;
     uint8_t payload[] = "Payload";
index 3e90beed96e4542654db171f74ae089700174b02..3b57a9e47a56edb444e23377a0f299935b863ddf 100644 (file)
 #ifdef UNITTESTS
 uint32_t UTHSetIPv4Address(char *);
 
-Packet *UTHBuildPacketReal(uint8_t *, uint16_t, uint16_t, char *, char *, uint16_t, uint16_t);
-Packet *UTHBuildPacket(uint8_t *, uint16_t, uint16_t);
-Packet *UTHBuildPacketSrcDst(uint8_t *, uint16_t, uint16_t, char *, char *);
-Packet *UTHBuildPacketSrcDstPorts(uint8_t *, uint16_t, uint16_t, uint16_t, uint16_t);
+Packet *UTHBuildPacketReal(uint8_t *, uint16_t, uint8_t ipproto, char *, char *, uint16_t, uint16_t);
+Packet *UTHBuildPacket(uint8_t *, uint16_t, uint8_t ipproto);
+Packet *UTHBuildPacketSrcDst(uint8_t *, uint16_t, uint8_t ipproto, char *, char *);
+Packet *UTHBuildPacketSrcDstPorts(uint8_t *, uint16_t, uint8_t ipproto, uint16_t, uint16_t);
 
-Packet *UTHBuildPacketIPV6SrcDst(uint8_t *, uint16_t, uint16_t, char *, char *);
+Packet *UTHBuildPacketIPV6SrcDst(uint8_t *, uint16_t, uint8_t ipproto, char *, char *);
 
 int UTHPacketMatchSigMpm(Packet *, char *, uint16_t);
 Packet **UTHBuildPacketArrayFromEth(uint8_t **, int *, int);
@@ -54,7 +54,7 @@ int UTHMatchPacketsWithResults(DetectEngineCtx *, Packet **, int, uint32_t *, ui
 int UTHGenericTest(Packet **, int, char **, uint32_t *, uint32_t *, int);
 
 uint32_t UTHBuildPacketOfFlows(uint32_t, uint32_t, uint8_t);
-Packet *UTHBuildPacketIPV6Real(uint8_t *, uint16_t , uint16_t , char *, char *,
+Packet *UTHBuildPacketIPV6Real(uint8_t *, uint16_t , uint8_t ipproto, char *, char *,
                            uint16_t , uint16_t );
 #endif