浏览代码

parser: added macros to check if it is a SIP or HTTP reply

Daniel-Constantin Mierla 12 年之前
父节点
当前提交
33557b2de1
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      parser/msg_parser.h

+ 10 - 0
parser/msg_parser.h

@@ -156,6 +156,16 @@ if (  (*tmp==(firstchar) || *tmp==((firstchar) | 32)) &&                  \
     !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: