BLOG | DOCUMENTATION | TRAC

Home --> Documentations --> PJLIB Reference

activesock.h
Go to the documentation of this file.
1 /* $Id: activesock.h 4359 2013-02-21 11:18:36Z bennylp $ */
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 
148  pj_sock_t newsock,
149  const pj_sockaddr_t *src_addr,
150  int src_addr_len);
151 
165  pj_status_t status);
166 
168 
169 
174 typedef struct pj_activesock_cfg
175 {
180 
193  unsigned async_cnt;
194 
209 
224 
226 
227 
233 PJ_DECL(void) pj_activesock_cfg_default(pj_activesock_cfg *cfg);
234 
235 
259  pj_sock_t sock,
260  int sock_type,
261  const pj_activesock_cfg *opt,
262  pj_ioqueue_t *ioqueue,
263  const pj_activesock_cb *cb,
264  void *user_data,
265  pj_activesock_t **p_asock);
266 
290  const pj_sockaddr *addr,
291  const pj_activesock_cfg *opt,
292  pj_ioqueue_t *ioqueue,
293  const pj_activesock_cb *cb,
294  void *user_data,
295  pj_activesock_t **p_asock,
296  pj_sockaddr *bound_addr);
297 
308 
309 #if (defined(PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT) && \
310  PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT!=0) || \
311  defined(DOXYGEN)
312 
325 PJ_DECL(void) pj_activesock_set_iphone_os_bg(pj_activesock_t *asock,
326  int val);
327 
341 PJ_DECL(void) pj_activesock_enable_iphone_os_bg(pj_bool_t val);
342 #endif
343 
357  void *user_data);
358 
367 PJ_DECL(void*) pj_activesock_get_user_data(pj_activesock_t *asock);
368 
369 
393  pj_pool_t *pool,
394  unsigned buff_size,
395  pj_uint32_t flags);
396 
412  pj_pool_t *pool,
413  unsigned buff_size,
414  void *readbuf[],
415  pj_uint32_t flags);
416 
431  pj_pool_t *pool,
432  unsigned buff_size,
433  pj_uint32_t flags);
434 
450  pj_pool_t *pool,
451  unsigned buff_size,
452  void *readbuf[],
453  pj_uint32_t flags);
454 
477  const void *data,
478  pj_ssize_t *size,
479  unsigned flags);
480 
503  pj_ioqueue_op_key_t *send_key,
504  const void *data,
505  pj_ssize_t *size,
506  unsigned flags,
507  const pj_sockaddr_t *addr,
508  int addr_len);
509 
510 #if PJ_HAS_TCP
511 
531  pj_pool_t *pool);
532 
551  pj_pool_t *pool,
552  const pj_sockaddr_t *remaddr,
553  int addr_len);
554 
555 
556 #endif /* PJ_HAS_TCP */
557 
563 
564 #endif /* __PJ_ASYNCSOCK_H__ */
565 

 


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