Axis2/C: axutil_network_handler.h Source File

- Main Page
- Modules
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

# axutil_network_handler.h

    00001
    00002 /*
    00003  * Copyright 2004,2005 The Apache Software Foundation.
    00004  *
    00005  * Licensed under the Apache License, Version 2.0 (the "License");
    00006  * you may not use this file except in compliance with the License.
    00007  * You may obtain count copy of the License at
    00008  *
    00009  *      http://www.apache.org/licenses/LICENSE-2.0
    00010  *
    00011  * Unless required by applicable law or agreed to in writing, software
    00012  * distributed under the License is distributed on an "AS IS" BASIS,
    00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00014  * See the License for the specific language governing permissions and
    00015  * limitations under the License.
    00016  */
    00017
    00018 #ifndef AXUTIL_NETWORK_HANDLER_H
    00019 #define AXUTIL_NETWORK_HANDLER_H
    00020
    00021 #include <axutil_utils.h>
    00022 #include <axutil_utils_defines.h>
    00023 #include <axutil_env.h>
    00024 #include <sys/types.h>
    00025 #include <platforms/axutil_platform_auto_sense.h>
    00026
    00027 #ifdef __cplusplus
    00028 extern "C"
    00029 {
    00030 #endif
    00031
    00044     AXIS2_EXTERN axis2_socket_t AXIS2_CALL
    00045
    00046     axutil_network_handler_open_socket(
    00047         const axutil_env_t * env,
    00048         char *server,
    00049         int port);
    00050
    00056     AXIS2_EXTERN axis2_socket_t AXIS2_CALL
    00057
    00058     axutil_network_handler_create_server_socket(
    00059         const axutil_env_t * env,
    00060         int port);
    00061
    00067     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00068
    00069     axutil_network_handler_close_socket(
    00070         const axutil_env_t * env,
    00071         axis2_socket_t socket);
    00072
    00080     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00081
    00082     axutil_network_handler_set_sock_option(
    00083         const axutil_env_t * env,
    00084         axis2_socket_t socket,
    00085         int option,
    00086         int value);
    00087
    00093     AXIS2_EXTERN axis2_socket_t AXIS2_CALL
    00094
    00095     axutil_network_handler_svr_socket_accept(
    00096         const axutil_env_t * env,
    00097         axis2_socket_t socket);
    00098
    00104     AXIS2_EXTERN axis2_char_t *AXIS2_CALL
    00105     axutil_network_handler_get_svr_ip(
    00106         const axutil_env_t * env,
    00107         axis2_socket_t socket);
    00108
    00109     AXIS2_EXTERN axis2_char_t *AXIS2_CALL
    00110     axutil_network_handler_get_peer_ip(
    00111         const axutil_env_t * env,
    00112         axis2_socket_t socket);
    00113
    00114         /*
    00115          * Create a datagram socket.
    00116          * @param env pointer to env
    00117          * @return a datagram socket
    00118          */
    00119         AXIS2_EXTERN axis2_socket_t AXIS2_CALL
    00120         axutil_network_handler_open_dgram_socket(const axutil_env_t *env);
    00121
    00122         /*
    00123          * Send a UDP packet to the given source and port address.
    00124          * Read a incoming UDP packet from the port and server address.
    00125          * @param env pointer to the env structure
    00126          * @param socket a datagram socket
    00127          * @param buffer a buffer containing the data to be sent
    00128          * @param buf_len length of the buffer
    00129          * @param addr address of the source field
    00130          * @param port udp port number
    00131          * @return success if everything goes well
    00132          */
    00133         AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00134         axutil_network_handler_send_dgram(const axutil_env_t *env, axis2_socket_t socket,
    00135                                                                  axis2_char_t *buff, int *buf_len,
    00136                                                                  axis2_char_t *addr, int dest_port, int *source_port);
    00137
    00138         /*
    00139          * Read a incoming UDP packet from the port and server address.
    00140          * @param env pointer to the env structure
    00141          * @param socket a datagram socket
    00142          * @param buffer a buffer allocated and passed to be filled
    00143          * @param buf_len length of the buffer allocated. In return buffer len
    00144                           contains the length of the data read
    00145          * @param addr address of the sender. This is a return value.
    00146          * @param port senders port address. Return value
    00147          * @return if everything goes well return success
    00148          */
    00149         AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00150         axutil_network_handler_read_dgram(const axutil_env_t *env, axis2_socket_t socket,
    00151                                                                          axis2_char_t *buffer, int *buf_len,
    00152                                                                          axis2_char_t **addr, int *port);
    00153
    00154         /*
    00155          * Create a datagram socket to receive incoming UDP packets.
    00156          * @param env a pointer to the env structure
    00157          * @param port udp port to listen
    00158          * @return AXIS2_SUCCESS if everything goes well
    00159          */
    00160         AXIS2_EXTERN axis2_socket_t AXIS2_CALL
    00161         axutil_network_handler_create_dgram_svr_socket(
    00162                                                                         const axutil_env_t *env,
    00163                                                                         int port);
    00164
    00165         /*
    00166          * Bind a socket to the specified address
    00167          * @param env a pointer to the env structure
    00168          * @param sock socket
    00169          * @param port port number to bind to
    00170          * @return AXIS2_SUCCESS if binding is performed
    00171          */
    00172         AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00173         axutil_network_handler_bind_socket(const axutil_env_t *env,
    00174                                                                         axis2_socket_t sock, int port);
    00175
    00176         /*
    00177          * Create a multicast socket for listening on the given port.
    00178          * @param env a pointer to the env structure
    00179          * @param port udp port to listen
    00180          * @param mul_addr multicast address to join. The address should be valid and in dotted format.
    00181          * @param ttl TTL value.
    00182          * @return AXIS2_SUCCESS if everything goes well.s
    00183          */
    00184         AXIS2_EXTERN axis2_socket_t AXIS2_CALL
    00185         axutil_network_hadler_create_multicast_svr_socket(const axutil_env_t *env,
    00186                                                                         int port, axis2_char_t *mul_addr);
    00187
    00190 #ifdef __cplusplus
    00191 }
    00192 #endif
    00193
    00194 #endif                          /* AXIS2_NETWORK_HANDLER_H */