BLOG | DOCUMENTATION | TRAC

Home --> Documentations --> PJLIB Reference

activesock.h
Go to the documentation of this file.
1 /* $Id: activesock.h 4461 2013-04-05 03:02:19Z riza $ */
2 /*
3  * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4  * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20 #ifndef __PJ_ASYNCSOCK_H__
21 #define __PJ_ASYNCSOCK_H__
22 
28 #include <pj/ioqueue.h>
29 #include <pj/sock.h>
30 
31 
33 
52 
56 typedef struct pj_activesock_cb
57 {
85  void *data,
86  pj_size_t size,
87  pj_status_t status,
88  pj_size_t *remainder);
110  void *data,
111  pj_size_t size,
112  const pj_sockaddr_t *src_addr,
113  int addr_len,
114  pj_status_t status);
115 
131  pj_ssize_t sent);
132 
149  pj_sock_t newsock,
150  const pj_sockaddr_t *src_addr,
151  int src_addr_len);
152 
172  pj_sock_t newsock,
173  const pj_sockaddr_t *src_addr,
174  int src_addr_len,
175  pj_status_t status);
176 
190  pj_status_t status);
191 
193 
194 
199 typedef struct pj_activesock_cfg
200 {
205 
218  unsigned async_cnt;
219 
234 
249 
251 
252 
258 PJ_DECL(void) pj_activesock_cfg_default(pj_activesock_cfg *cfg);
259 
260 
284  pj_sock_t sock,
285  int sock_type,
286  const pj_activesock_cfg *opt,
287  pj_ioqueue_t *ioqueue,
288  const pj_activesock_cb *cb,
289  void *user_data,
290  pj_activesock_t **p_asock);
291 
315  const pj_sockaddr *addr,
316  const pj_activesock_cfg *opt,
317  pj_ioqueue_t *ioqueue,
318  const pj_activesock_cb *cb,
319  void *user_data,
320  pj_activesock_t **p_asock,
321  pj_sockaddr *bound_addr);
322 
333 
334 #if (defined(PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT) && \
335  PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT!=0) || \
336  defined(DOXYGEN)
337 
350 PJ_DECL(void) pj_activesock_set_iphone_os_bg(pj_activesock_t *asock,
351  int val);
352 
366 PJ_DECL(void) pj_activesock_enable_iphone_os_bg(pj_bool_t val);
367 #endif
368 
382  void *user_data);
383 
392 PJ_DECL(void*) pj_activesock_get_user_data(pj_activesock_t *asock);
393 
394 
418  pj_pool_t *pool,
419  unsigned buff_size,
420  pj_uint32_t flags);
421 
437  pj_pool_t *pool,
438  unsigned buff_size,
439  void *readbuf[],
440  pj_uint32_t flags);
441 
456  pj_pool_t *pool,
457  unsigned buff_size,
458  pj_uint32_t flags);
459 
475  pj_pool_t *pool,
476  unsigned buff_size,
477  void *readbuf[],
478  pj_uint32_t flags);
479 
502  const void *data,
503  pj_ssize_t *size,
504  unsigned flags);
505 
528  pj_ioqueue_op_key_t *send_key,
529  const void *data,
530  pj_ssize_t *size,
531  unsigned flags,
532  const pj_sockaddr_t *addr,
533  int addr_len);
534 
535 #if PJ_HAS_TCP
536 
556  pj_pool_t *pool);
557 
576  pj_pool_t *pool,
577  const pj_sockaddr_t *remaddr,
578  int addr_len);
579 
580 
581 #endif /* PJ_HAS_TCP */
582 
588 
589 #endif /* __PJ_ASYNCSOCK_H__ */
590 

 


PJLIB Open Source, high performance, small footprint, and very very portable framework
Copyright (C) 2006-2009 Teluu Inc.