home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 15 / AACD15.ISO / AACD / Magazine / HomeAutomation / Apache / include / php / ext / standard / fsock.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-03-06  |  4.1 KB  |  123 lines

  1. /*
  2.    +----------------------------------------------------------------------+
  3.    | PHP HTML Embedded Scripting Language Version 3.0                     |
  4.    +----------------------------------------------------------------------+
  5.    | Copyright (c) 1997-1999 PHP Development Team (See Credits file)      |
  6.    +----------------------------------------------------------------------+
  7.    | This program is free software; you can redistribute it and/or modify |
  8.    | it under the terms of one of the following licenses:                 |
  9.    |                                                                      |
  10.    |  A) the GNU General Public License as published by the Free Software |
  11.    |     Foundation; either version 2 of the License, or (at your option) |
  12.    |     any later version.                                               |
  13.    |                                                                      |
  14.    |  B) the PHP License as published by the PHP Development Team and     |
  15.    |     included in the distribution in the file: LICENSE                |
  16.    |                                                                      |
  17.    | This program is distributed in the hope that it will be useful,      |
  18.    | but WITHOUT ANY WARRANTY; without even the implied warranty of       |
  19.    | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        |
  20.    | GNU General Public License for more details.                         |
  21.    |                                                                      |
  22.    | You should have received a copy of both licenses referred to here.   |
  23.    | If you did not, or have any questions about PHP licensing, please    |
  24.    | contact core@php.net.                                                |
  25.    +----------------------------------------------------------------------+
  26.    | Authors: Paul Panotzki - Bunyip Information Systems                  |
  27.    |          Jim Winstead (jimw@php.net)                                 |
  28.    +----------------------------------------------------------------------+
  29. */
  30. /* $Id: fsock.h,v 1.27 2000/03/06 20:37:11 ssb Exp $ */
  31.  
  32. /* Synced with php 3.0 revision 1.24 1999-06-18 [ssb] */
  33.  
  34. #ifndef _FSOCK_H
  35. #define _FSOCK_H
  36.  
  37. #ifdef PHP_WIN32
  38. # ifndef WINNT
  39. #  define WINNT 1
  40. # endif
  41. # undef FD_SETSIZE
  42. # include "arpa/inet.h"
  43. # define socklen_t unsigned int
  44. #endif
  45.  
  46. #ifdef HAVE_NETINET_IN_H
  47. # include <netinet/in.h>
  48. #endif
  49.  
  50. #ifdef HAVE_SYS_SOCKET_H
  51. #include <sys/socket.h>
  52. #endif
  53.  
  54. #ifdef HAVE_SYS_TIME_H
  55. #include <sys/time.h>
  56. #endif
  57.  
  58. struct php_sockbuf {
  59.     int socket;
  60.     unsigned char *readbuf;
  61.     size_t readbuflen;
  62.     size_t readpos;
  63.     size_t writepos;
  64.     struct php_sockbuf *next;
  65.     struct php_sockbuf *prev;
  66.     char eof;
  67.     char persistent;
  68.     char is_blocked;
  69.     size_t chunk_size;
  70.     struct timeval timeout;
  71.     char timeout_event;
  72. };
  73.  
  74. typedef struct php_sockbuf php_sockbuf;
  75.  
  76. PHP_FUNCTION(fsockopen);
  77. PHP_FUNCTION(pfsockopen);
  78.  
  79. int lookup_hostname(const char *addr, struct in_addr *in);
  80. char *php_sock_fgets(char *buf, size_t maxlen, int socket);
  81. size_t php_sock_fread(char *buf, size_t maxlen, int socket);
  82. int php_sock_feof(int socket);
  83. int php_sock_fgetc(int socket);
  84. int php_is_persistent_sock(int);
  85. int php_sockset_blocking(int socket, int mode);
  86. void php_sockset_timeout(int socket, struct timeval *timeout);
  87. int php_sockdestroy(int socket);
  88. int php_sock_close(int socket);
  89. size_t php_sock_set_def_chunk_size(size_t size);
  90. void php_msock_destroy(int *data);
  91.  
  92. PHPAPI int connect_nonb(int sockfd, struct sockaddr *addr, socklen_t addrlen, struct timeval *timeout);
  93. PHPAPI struct php_sockbuf *php_get_socket(int socket);
  94.  
  95. PHP_MINIT_FUNCTION(fsock);
  96. PHP_MSHUTDOWN_FUNCTION(fsock);
  97. PHP_RSHUTDOWN_FUNCTION(fsock);
  98.  
  99. typedef struct {
  100.     HashTable ht_fsock_keys;
  101.     HashTable ht_fsock_socks;
  102.     struct php_sockbuf *phpsockbuf;
  103.     size_t def_chunk_size;
  104. } php_fsock_globals;
  105.  
  106. #ifdef ZTS
  107. #define FLS_D php_fsock_globals *fsock_globals
  108. #define FLS_DC , FLS_D
  109. #define FLS_C fsock_globals
  110. #define FLS_CC , FLS_C
  111. #define FG(v) (fsock_globals->v)
  112. #define FLS_FETCH() php_fsock_globals *fsock_globals = ts_resource(fsock_globals_id)
  113. #else
  114. #define FLS_D    void
  115. #define FLS_DC
  116. #define FLS_C
  117. #define FLS_CC
  118. #define FG(v) (fsock_globals.v)
  119. #define FLS_FETCH()
  120. #endif
  121.  
  122. #endif /* _FSOCK_H */
  123.