Module: kamailio
Branch: master
Commit: 9f556322d8802239d40b2b39a6a150ff77014453
URL:
https://github.com/kamailio/kamailio/commit/9f556322d8802239d40b2b39a6a150f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-10-12T09:19:19+02:00
core: parser - use flags for macros to detect if it is sip or http
---
Modified: src/core/parser/msg_parser.h
---
Diff:
https://github.com/kamailio/kamailio/commit/9f556322d8802239d40b2b39a6a150f…
Patch:
https://github.com/kamailio/kamailio/commit/9f556322d8802239d40b2b39a6a150f…
---
diff --git a/src/core/parser/msg_parser.h b/src/core/parser/msg_parser.h
index d2ff887372..1abc042e28 100644
--- a/src/core/parser/msg_parser.h
+++ b/src/core/parser/msg_parser.h
@@ -141,28 +141,26 @@ if ( (*tmp==(firstchar) || *tmp==((firstchar) | 32)) &&
\
tmp=buffer+methodname##_LEN; \
}
-#define IS_HTTP(req) \
- ((req)->first_line.u.request.version.len >= HTTP_VERSION_LEN && \
- !strncasecmp((req)->first_line.u.request.version.s, \
- HTTP_VERSION, HTTP_VERSION_LEN))
-
-#define IS_SIP(req) \
- ((req)->first_line.u.request.version.len >= SIP_VERSION_LEN && \
- !strncasecmp((req)->first_line.u.request.version.s, \
- SIP_VERSION, SIP_VERSION_LEN))
-
-#define IS_HTTP_REPLY(rpl) \
- (((rpl)->first_line.u.reply.version.len >= HTTP_VERSION_LEN && \
- !strncasecmp((rpl)->first_line.u.reply.version.s, \
- HTTP_VERSION, HTTP_VERSION_LEN)) || \
- ((rpl)->first_line.u.reply.version.len >= HTTP2_VERSION_LEN && \
- !strncasecmp((rpl)->first_line.u.reply.version.s, \
- HTTP2_VERSION, HTTP2_VERSION_LEN)))
-
-#define IS_SIP_REPLY(rpl) \
- ((rpl)->first_line.u.reply.version.len >= SIP_VERSION_LEN && \
- !strncasecmp((rpl)->first_line.u.reply.version.s, \
- SIP_VERSION, SIP_VERSION_LEN))
+
+/* sip request */
+#define IS_SIP(req) \
+ (((req)->first_line.type == SIP_REQUEST) && \
+ ((req)->first_line.type & FLINE_FLAG_PROTO_SIP))
+
+/* sip reply */
+#define IS_SIP_REPLY(rpl) \
+ (((rpl)->first_line.type == SIP_REPLY) && \
+ ((rpl)->first_line.type & FLINE_FLAG_PROTO_SIP))
+
+/* http request */
+#define IS_HTTP(req) \
+ (((req)->first_line.type == SIP_REQUEST) && \
+ ((req)->first_line.type & FLINE_FLAG_PROTO_HTTP))
+
+/* http reply */
+#define IS_HTTP_REPLY(rpl) \
+ (((rpl)->first_line.type == SIP_REPLY) && \
+ ((rpl)->first_line.type & FLINE_FLAG_PROTO_HTTP))
/*! \brief
* Return a URI to which the message should be really sent (not what should