summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-02-18 01:50:01 +0000
committerBenny Prijono <bennylp@teluu.com>2007-02-18 01:50:01 +0000
commitb69fdc0692fcda7bdec66fb475ce8b6167d6821e (patch)
tree57a6d8ad8bdc3ddb2a8a04d6c3b82242be320fe0
parentad007dee63a93f97fd5559654514bbd2526bf4d1 (diff)
Added TCP transport in sipstateless sample
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@967 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip-apps/src/samples/sipstateless.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/pjsip-apps/src/samples/sipstateless.c b/pjsip-apps/src/samples/sipstateless.c
index d81c518f..d6bf01ec 100644
--- a/pjsip-apps/src/samples/sipstateless.c
+++ b/pjsip-apps/src/samples/sipstateless.c
@@ -20,10 +20,9 @@
/**
* sipcore.c
*
- * This program is only used to measure the footprint of the SIP core.
- * When UDP transport is included (with HAS_UDP_TRANSPORT macro), the
- * executable will respond any incoming requests with 501 (Not Implemented)
- * response statelessly.
+ * A simple program to respond any incoming requests (except ACK, of course!)
+ * with any status code (taken from command line argument, with the default
+ * is 501/Not Implemented).
*/
@@ -36,6 +35,8 @@
/* If this macro is set, UDP transport will be initialized at port 5060 */
#define HAS_UDP_TRANSPORT
+/* If this macro is set, TCP transport will be initialized at port 5060 */
+#define HAS_TCP_TRANSPORT
/* Log identification */
#define THIS_FILE "sipstateless.c"
@@ -140,6 +141,26 @@ int main(int argc, char *argv[])
}
#endif
+#ifdef HAS_TCP_TRANSPORT
+ /*
+ * Add UDP transport, with hard-coded port
+ */
+ {
+ pj_sockaddr_in addr;
+
+ addr.sin_family = PJ_AF_INET;
+ addr.sin_addr.s_addr = 0;
+ addr.sin_port = pj_htons(5060);
+
+ status = pjsip_tcp_transport_start(sip_endpt, &addr, 1, NULL);
+ if (status != PJ_SUCCESS) {
+ PJ_LOG(3,(THIS_FILE,
+ "Error starting TCP transport (port in use?)"));
+ return 1;
+ }
+ }
+#endif
+
/*
* Register our module to receive incoming requests.
*/