Procházet zdrojové kódy

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

Daniel-Constantin Mierla před 12 roky
rodič
revize
33557b2de1
1 změnil soubory, kde provedl 10 přidání a 0 odebrání
  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,             \
     !strncasecmp((req)->first_line.u.request.version.s,             \
 		SIP_VERSION, SIP_VERSION_LEN))
 		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
 /*! \brief
  * Return a URI to which the message should be really sent (not what should
  * 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:
  * be in the Request URI. The following fields are tried in this order: