[sr-dev] git:master: parser: added macros to check if it is a SIP or HTTP reply

Daniel-Constantin Mierla miconda at gmail.com
Mon Sep 23 19:01:51 CEST 2013


Module: sip-router
Branch: master
Commit: 33557b2de1631601be9b03447e3167d06e8ce1cb
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=33557b2de1631601be9b03447e3167d06e8ce1cb

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Mon Sep 23 18:40:48 2013 +0200

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

---

 parser/msg_parser.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/parser/msg_parser.h b/parser/msg_parser.h
index d6df9b3..475716b 100644
--- a/parser/msg_parser.h
+++ b/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:




More information about the sr-dev mailing list