Changeset 1576 for pjproject/trunk/pjsip-apps/src/samples/debug.c
- Timestamp:
- Nov 11, 2007 9:00:22 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/samples/debug.c
r974 r1576 28 28 * #include "playfile.c" 29 29 */ 30 #include "aectest.c" 30 //#include "aectest.c" 31 #include <pjlib.h> 32 33 34 static void on_accept_complete(pj_ioqueue_key_t *key, 35 pj_ioqueue_op_key_t *op_key, 36 pj_sock_t sock, 37 pj_status_t status) 38 { 39 } 40 41 static void on_read_complete(pj_ioqueue_key_t *key, 42 pj_ioqueue_op_key_t *op_key, 43 pj_ssize_t bytes_read) 44 { 45 } 46 47 48 int main() 49 { 50 pj_status_t status; 51 pj_caching_pool cp; 52 pj_pool_t *pool; 53 pj_sock_t sock, new_sock; 54 pj_ioqueue_t *ioqueue; 55 pj_ioqueue_op_key_t op_key; 56 pj_ioqueue_callback cb; 57 pj_ioqueue_key_t *key; 58 59 status = pj_init(); 60 PJ_ASSERT_RETURN(status==PJ_SUCCESS, 1); 61 62 pj_caching_pool_init(&cp, NULL, 0); 63 pool = pj_pool_create(&cp.factory, "app", 1000, 1000, NULL); 64 65 status = pj_sock_socket(pj_AF_INET(), pj_SOCK_STREAM(), 0, &sock); 66 PJ_ASSERT_RETURN(status==PJ_SUCCESS, 1); 67 68 status = pj_sock_bind_in(sock, 0, 80); 69 if (status != PJ_SUCCESS) 70 return 1; 71 72 status = pj_ioqueue_create(pool, PJ_IOQUEUE_MAX_HANDLES, &ioqueue); 73 PJ_ASSERT_RETURN(status==PJ_SUCCESS, 1); 74 75 status = pj_sock_listen(sock, 5); 76 PJ_ASSERT_RETURN(status==PJ_SUCCESS, 1); 77 78 pj_bzero(&cb, sizeof(cb)); 79 cb.on_accept_complete = &on_accept_complete; 80 cb.on_read_complete = &on_read_complete; 81 82 status = pj_ioqueue_register_sock(pool, ioqueue, sock, NULL, &cb, &key); 83 PJ_ASSERT_RETURN(status==PJ_SUCCESS, 1); 84 85 pj_ioqueue_op_key_init(&op_key, sizeof(op_key)); 86 status = pj_ioqueue_accept(key, &op_key, &new_sock, NULL, NULL, NULL); 87 PJ_ASSERT_RETURN(status==PJ_EPENDING, 1); 88 } 89
Note: See TracChangeset
for help on using the changeset viewer.