parser: added macros to check if it is a SIP or HTTP reply
authorDaniel-Constantin Mierla <miconda@gmail.com>
Mon, 23 Sep 2013 16:40:48 +0000 (18:40 +0200)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Mon, 23 Sep 2013 16:40:48 +0000 (18:40 +0200)
parser/msg_parser.h

index d6df9b3..475716b 100644 (file)
@@ -156,6 +156,16 @@ if (  (*tmp==(firstchar) || *tmp==((firstchar) | 32)) &&                  \
     !strncasecmp((req)->first_line.u.request.version.s,             \
                SIP_VERSION, 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))
+
+#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))
+
 /*! \brief
  * Return a URI to which the message should be really sent (not what should
  * be in the Request URI. The following fields are tried in this order:
 /*! \brief
  * Return a URI to which the message should be really sent (not what should
  * be in the Request URI. The following fields are tried in this order: