PageRenderTime 23ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/branches/singlestack/binding-c/runtime/c/include/etch_tcp_connection.h

#
C Header | 97 lines | 51 code | 18 blank | 28 comment | 0 complexity | b52fe9eab438cc47e2a1b02a8dadbcf6 MD5 | raw file
Possible License(s): Apache-2.0
  1. /* $Id$
  2. *
  3. * Licensed to the Apache Software Foundation (ASF) under one or more
  4. * contributor license agreements. See the NOTICE file distributed with
  5. * this work for additional information regarding copyright ownership.
  6. * The ASF licenses this file to you under the Apache License, Version
  7. * 2.0 (the "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. /*
  19. * etch_connection.h
  20. * connection client and server classes - tcp
  21. */
  22. #ifndef _ETCH_TCP_CONNECTION_H_
  23. #define _ETCH_TCP_CONNECTION_H_
  24. #include "apr_thread_proc.h"
  25. #include "etch_connection.h"
  26. #include "etch_transport_data.h"
  27. #include "etch_transportint.h"
  28. #include "etch_session_data.h"
  29. #include "etch_url.h"
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. struct etch_tcp_client;
  34. /*
  35. * tcp specific connection type
  36. */
  37. typedef struct etch_tcp_connection
  38. {
  39. ETCH_TRANSPORT_CONNECTION_COMMON_TYPES;
  40. struct etch_tcp_client* rcvlxr; /* owned */
  41. i_transportdata* itd; /* owned */
  42. i_sessiondata* session; /* not owned */
  43. int linger;
  44. int traffic_class;
  45. unsigned char is_nodelay;
  46. unsigned char is_keepalive;
  47. unsigned char is_autoflush;
  48. unsigned char is_session_owned;
  49. } etch_tcp_connection;
  50. /**
  51. * etch_tcp_client
  52. * tcp client listener class
  53. */
  54. typedef struct etch_tcp_client
  55. {
  56. ETCH_CLIENT_COMMON_TYPES;
  57. etch_tcp_connection* cxlisten; /* not owned */
  58. } etch_tcp_client;
  59. extern unsigned connection_id_farm;
  60. etch_tcp_connection* new_tcp_connection(etch_url*, void* resources, etch_rawsocket*);
  61. int init_etch_tcpconx_interfaces (etch_tcp_connection*);
  62. int new_tcpsocket (apr_socket_t**, apr_pool_t*);
  63. int destroy_etch_tcp_connection(void* thisx);
  64. int etch_tcpconx_start(etch_tcp_connection*);
  65. int etch_tcpclient_start_listener (etch_tcp_connection*);
  66. int etch_tcpconx_open (etch_tcp_connection*, const int is_reconnect);
  67. int etch_tcpconx_close(etch_tcp_connection*, const int is_linger);
  68. int etch_tcpconx_wait_until(etch_tcp_connection*, const int64 waitval, const int timeoutms);
  69. int etch_tcpclient_send(etch_tcp_connection *conx, unsigned char* buf, const size_t totallen, int* rc);
  70. int etch_tcpclient_sendex (etch_tcp_connection *conx, unsigned char* buf, const size_t totallen, const int timeout_ms, int* rc);
  71. int etch_tcpclient_receive (etch_tcp_connection*, unsigned char*, const size_t, int*);
  72. int etch_tcpclient_receivex(etch_tcp_connection*, unsigned char*, const size_t, const int, int*);
  73. int etch_tcpclient_stop(etch_tcp_connection*);
  74. int etch_tcpclient_stop_listener (etch_tcp_connection*);
  75. int is_good_tcp_params(etch_url*, void* resources, etch_rawsocket*);
  76. #ifdef __cplusplus
  77. }
  78. #endif
  79. #endif /* ETCHTCPCONXN_H */