lwes_net_functions.h

Go to the documentation of this file.
00001 /*======================================================================*
00002  * Copyright (C) 2008 Light Weight Event System                         *
00003  * All rights reserved.                                                 *
00004  *                                                                      *
00005  * This program is free software; you can redistribute it and/or modify *
00006  * it under the terms of the GNU General Public License as published by *
00007  * the Free Software Foundation; either version 2 of the License, or    *
00008  * (at your option) any later version.                                  *
00009  *                                                                      *
00010  * This program is distributed in the hope that it will be useful,      *
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
00013  * GNU General Public License for more details.                         *
00014  *                                                                      *
00015  * You should have received a copy of the GNU General Public License    *
00016  * along with this program; if not, write to the Free Software          *
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor,                   *
00018  * Boston, MA 02110-1301 USA.                                           *
00019  *======================================================================*/
00020 #ifndef __LWES_NET_FUNCTIONS_H
00021 #define __LWES_NET_FUNCTIONS_H
00022 
00023 #include <stdio.h>
00024 #include <stdlib.h>
00025 #include <ctype.h>
00026 #include <errno.h>
00027 #include <sys/types.h>
00028 #include <sys/time.h>
00029 #include <sys/socket.h>
00030 #include <netinet/in.h>
00031 #include <arpa/inet.h>
00032 #include <unistd.h>
00033 
00034 #include "lwes_types.h"
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif 
00039 
00047 struct lwes_net_connection 
00048 {
00050   int socketfd;
00051 
00053   struct sockaddr_in mcast_addr;
00054 
00056   struct ip_mreq     mreq;
00057 
00059   struct sockaddr_in sender_ip_addr;
00060 
00062   socklen_t sender_ip_socket_size;
00063 
00066   int hasJoined;
00067 };
00068 
00079 int
00080 lwes_net_open
00081   (struct lwes_net_connection *conn,
00082    const char *address, 
00083    const char *iface,
00084    int port);
00085 
00093 int
00094 lwes_net_close
00095   (struct lwes_net_connection *conn);
00096 
00103 int
00104 lwes_net_get_ttl
00105   (struct lwes_net_connection *conn);
00106 
00114 int
00115 lwes_net_set_ttl
00116   (struct lwes_net_connection *conn, int new_ttl);
00117 
00124 int
00125 lwes_net_get_sock_fd
00126   (struct lwes_net_connection *conn);
00127 
00136 int
00137 lwes_net_send_bytes
00138   (struct lwes_net_connection *conn,
00139    LWES_BYTE_P bytes,
00140    size_t len);
00141 
00159 int
00160 lwes_net_sendto_bytes
00161   (struct lwes_net_connection *conn,
00162    char *address,
00163    char *iface,
00164    int port,
00165    LWES_BYTE_P bytes,
00166    size_t len);
00167 
00177 int
00178 lwes_net_recv_bind
00179   (struct lwes_net_connection *conn);
00180 
00192 int
00193 lwes_net_recv_bytes
00194   (struct lwes_net_connection *conn, 
00195    LWES_BYTE_P bytes,
00196    size_t len);
00197 
00210 int
00211 lwes_net_recv_bytes_by
00212   (struct lwes_net_connection *conn, 
00213    LWES_BYTE_P bytes,
00214    size_t len,
00215    unsigned int timeout_ms);
00216 
00217 #ifdef __cplusplus
00218 }
00219 #endif 
00220 
00221 #endif /* __NET_FUNCTIONS_H */

Generated on Thu Aug 21 07:18:55 2008 for lwes by  doxygen 1.4.6