socket.h (r4203/r3618)

Go to the documentation of this file.
00001 /*
00002  * $Id: socket.h 3618 2006-11-02 17:08:30Z riedel $
00003  * Copyright (c) 2004
00004  * Telecooperation Office (TecO), Universitaet Karlsruhe (TH), Germany.
00005  * All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  * 1. Redistributions of source code must retain the above copyright
00011  *    notice, this list of conditions and the following disclaimer.
00012  * 2. Redistributions in binary form must reproduce the above
00013  *    copyright notice, this list of conditions and the following
00014  *    disclaimer in the documentation and/or other materials provided
00015  *    with the distribution.
00016  * 3. Neither the name of the Universitaet Karlsruhe (TH) nor the names
00017  *    of its contributors may be used to endorse or promote products
00018  *    derived from this software without specific prior written
00019  *    permission.
00020  *
00021  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00024  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00025  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00026  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00027  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00028  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00029  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00030  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00031  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00032  *
00033  * Author(s): Max Laier <mlaier@freebsd.org>
00034  *                        Thomas Morper <morper@teco.edu>
00035  */
00036 
00037 #ifndef _SOCKET_H_
00038 #define _SOCKET_H_
00039 
00040 #include "conf.h"
00041 #include "socket_enum.h"
00042 
00082 LIBPARTICLE_API int p_socket_open(uint32_t localip, uint32_t broadcast_add, int port);
00083 
00089 LIBPARTICLE_API int p_socket_close(int sock);
00090 
00097 LIBPARTICLE_API int p_socket_set_lastacks(int counter);
00098 
00105 LIBPARTICLE_API int p_socket_set_lastdups(int counter);
00106 
00115 LIBPARTICLE_API int p_socket_set_ipdest(int sock, const struct in_addr * address);
00116 
00125 LIBPARTICLE_API int p_socket_set_ipdest_str(int sock, const char * address);
00126 
00134 LIBPARTICLE_API int p_socket_set_ipdest_all(int fd);
00135 
00142 LIBPARTICLE_API int p_socket_set_ipsrc_all(int sock);
00143 
00152 LIBPARTICLE_API int p_socket_set_ipsrc(int sock, const struct in_addr * address);
00153 
00162 LIBPARTICLE_API int p_socket_set_ipsrc_str(int sock     , const char * address);
00163 
00172 LIBPARTICLE_API int p_socket_set_id(int sock, const uint8_t * add);
00173 
00184 LIBPARTICLE_API int p_socket_set_id_str(int sock, const char * addstr);
00185 
00194 LIBPARTICLE_API int p_socket_set_loc(int sock, const uint8_t * loc);
00195 
00204 LIBPARTICLE_API int p_socket_set_loc_str(int sock, const char * locstr);
00205 
00242 LIBPARTICLE_API int p_socket_set_option(int fd, int option, int mode);
00243 
00252 LIBPARTICLE_API int p_socket_set_retry(int sock, uint8_t retries, uint32_t timeout);
00253 
00259 LIBPARTICLE_API void p_describe_socket(int sock);
00260 
00266 LIBPARTICLE_API int p_socket_get_lastacks(void);
00267 
00268 
00276 LIBPARTICLE_API uint8_t* p_socket_get_id(int fd);
00277 
00285 LIBPARTICLE_API uint8_t* p_socket_get_loc(int fd);
00286 
00298 LIBPARTICLE_API uint8_t * p_socket_get_ipdest(int fd, int device_number);
00299 
00305 LIBPARTICLE_API int p_socket_get_num_interfaces(int fd);
00306 
00317 LIBPARTICLE_API int p_socket_set_num_interfaces(int fd, int counter);
00318 
00326 LIBPARTICLE_API uint8_t * p_socket_get_ipsrc(int fd);
00327 
00334 LIBPARTICLE_API int p_socket_get_retry(int fd);
00335 
00342 LIBPARTICLE_API uint32_t p_socket_get_timeout(int fd);
00343 
00349 LIBPARTICLE_API uint16_t p_socket_get_port(int fd);
00350 
00360 LIBPARTICLE_API int p_socket_get_option(int fd, int option);
00361 
00368 LIBPARTICLE_API int p_socket_get_blocking(int fd);
00369 
00376 LIBPARTICLE_API int p_socket_get_broadcast(int fd);
00377 
00385 LIBPARTICLE_API uint8_t p_socket_get_last_seq(int fd);
00386 
00387 /*
00388  * END: SOCKET ABSTRACTION
00389  */
00390 
00391 /*
00392  * BEGIN: RECEIVE DATA
00393  */
00394 
00410 LIBPARTICLE_API struct p_packet *p_socket_recv(int recv_sock, int send_sock);
00411 
00412 
00427 LIBPARTICLE_API struct p_packet *p_socket_recv_filtered(int recv_sock, int send_sock, int recv_filter);
00428 
00442 LIBPARTICLE_API int p_socket_recv_raw(int sock, char * data, size_t maxlen);
00443 
00452 struct timeval;
00453 LIBPARTICLE_API int p_socket_select(int fd, uint16_t milliseconds);
00454 
00455 /*
00456  * END: RECEIVE DATA
00457  */
00458 
00459 /*
00460  * BEGIN: SEND DATA
00461  */
00462 
00472 LIBPARTICLE_API int p_socket_send(int send_sock, struct p_packet * send_data);
00473 
00508 LIBPARTICLE_API int p_socket_send_addressed(int send_sock, struct p_packet * send_data, uint8_t * add);
00509 
00527 LIBPARTICLE_API int p_socket_send_addressed_str(int send_sock, struct p_packet * send_data, const char * add_str);
00528 
00552 LIBPARTICLE_API int p_socket_send_acked(int send_sock, int recv_sock, struct p_packet * send_data, const uint8_t * add);
00553 
00554 
00578 LIBPARTICLE_API int p_socket_send_acked_str(int send_sock, int recv_sock, struct p_packet * send_data, const char * addstr);
00579 
00603 LIBPARTICLE_API int p_socket_send_buffer(int fd_out, int fd_in, const char * buf, uint32_t len, const uint8_t * sendto, const uint8_t * acl_type);
00604 
00629 LIBPARTICLE_API int p_socket_send_buffer_str(int fd_out, int fd_in, const char * buf, uint32_t len, const char * sendto, const char * acl_type);
00630 
00655 LIBPARTICLE_API int p_socket_send_file(int fd_out, int fd_in, const char * filename, const uint8_t * sendto, const uint8_t * acl_type);
00656 
00670 LIBPARTICLE_API int p_socket_send_raw(int sock, const char * data, size_t len);
00671 
00679 LIBPARTICLE_API int p_socket_get_send_status(int sendticket);
00680 
00688 LIBPARTICLE_API int p_socket_delete_send_context(int sendticket);
00689 
00690 /*
00691  * END: SEND DATA
00692  */
00693 
00694 /*
00695  * Begin: Old functions...
00696  */
00697 
00702 int p_socket_set_broadcast();
00703 
00708 int p_socket_set_blocking();
00709 
00714 int p_socket_set_autoack();
00715 
00720 int p_socket_set_recv_option();
00721 
00726 int p_socket_set_frag_option();
00727 
00728 /*
00729  * end: Old functions
00730  */
00731 
00734 #endif /* _SOCKET_H_ */
00735 

Generated on Tue Apr 10 15:22:26 2007 for libparticle by  doxygen 1.5.1