PageRenderTime 42ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 1ms

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

#
C Header | 95 lines | 47 code | 19 blank | 29 comment | 0 complexity | 05ec461186fb847ae84d0921e24d5258 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 - udp
  21. */
  22. #ifndef _ETCH_UDP_CONNECTION_H_
  23. #define _ETCH_UDP_CONNECTION_H_
  24. #include "apr_thread_proc.h"
  25. #include "etch_connection.h"
  26. #include "etch_transport_packet.h"
  27. #include "etch_transportint.h"
  28. #include "etch_session_packet.h"
  29. #include "etch_url.h"
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. struct etch_udp_client;
  34. /*
  35. * udp specific connection type
  36. */
  37. typedef struct etch_udp_connection
  38. {
  39. ETCH_TRANSPORT_CONNECTION_COMMON_TYPES;
  40. struct etch_udp_client* rcvlxr; /* owned */
  41. i_transportpacket* itp; /* owned */
  42. i_sessionpacket* session; /* not owned */
  43. boolean is_server;
  44. apr_sockaddr_t *remote_addr;
  45. unsigned char is_reuseaddr;
  46. unsigned char is_broadcast;
  47. unsigned char is_session_owned;
  48. } etch_udp_connection;
  49. /**
  50. * etch_udp_client
  51. * udp client listener class
  52. */
  53. typedef struct etch_udp_client
  54. {
  55. ETCH_CLIENT_COMMON_TYPES;
  56. etch_udp_connection* cxlisten; /* not owned */
  57. } etch_udp_client;
  58. //extern unsigned connection_id_farm;
  59. int is_good_udp_params(etch_url*, void* resources, etch_rawsocket*);
  60. etch_udp_connection* new_udp_connection(etch_url*, void* resources, etch_rawsocket*);
  61. int init_etch_udpconx_interfaces (etch_udp_connection*);
  62. int new_udpsocket (apr_socket_t**, apr_pool_t*);
  63. int destroy_etch_udp_connection(void* thisx);
  64. int etch_udpconx_start(etch_udp_connection*);
  65. int etch_udpclient_start_listener (etch_udp_connection*);
  66. int etch_udpconx_open (etch_udp_connection*, const int is_reconnect);
  67. int etch_udpconx_close(etch_udp_connection*);
  68. int etch_udpclient_send(etch_udp_connection *conx, etch_who* whoto, unsigned char* buf, const size_t totallen, int* rc);
  69. int etch_udpclient_sendex (etch_udp_connection *conx, etch_who* whoto, unsigned char* buf, const size_t totallen, const int timeout_ms, int* rc);
  70. int etch_udpclient_receive (etch_udp_connection*, unsigned char*, const size_t, int*);
  71. int etch_udpclient_receivex(etch_udp_connection*, unsigned char*, const size_t, const int, int*);
  72. int etch_udpclient_stop_listener (etch_udp_connection*);
  73. #ifdef __cplusplus
  74. }
  75. #endif
  76. #endif /* _ETCH_UDP_CONNECTION_H_ */