packet.h (r4203/r3401)

Go to the documentation of this file.
00001 /*
00002  * $Id: packet.h 3401 2006-09-15 08:19:19Z riedel $
00003  *
00004  * Copyright (c) 2004
00005  * Telecooperation Office (TecO), Universitaet Karlsruhe (TH), Germany.
00006  * All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions
00010  * are met:
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  * 2. Redistributions in binary form must reproduce the above
00014  *    copyright notice, this list of conditions and the following
00015  *    disclaimer in the documentation and/or other materials provided
00016  *    with the distribution.
00017  * 3. Neither the name of the Universitaet Karlsruhe (TH) nor the names
00018  *    of its contributors may be used to endorse or promote products
00019  *    derived from this software without specific prior written
00020  *    permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00025  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00026  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00027  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00028  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00029  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00030  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00031  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00032  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033  *
00034  * Author(s): Max Laier <mlaier@freebsd.org>
00035  *                        Thomas Morper <morper@teco.edu>
00036  */
00037 
00046 #include <sys/types.h>
00047 #ifndef _PACKET_H_
00048 #define _PACKET_H_
00049 
00057 LIBPARTICLE_API struct p_packet *p_pkt_alloc(void);
00058 
00065 LIBPARTICLE_API struct p_packet *p_pkt_dup(const struct p_packet *packet);
00066 
00073 LIBPARTICLE_API int p_pkt_free(struct p_packet * packet);
00074 
00083 LIBPARTICLE_API int p_pkt_parse(struct p_packet *packet, const char *data, size_t len);
00084 
00091 LIBPARTICLE_API const uint8_t *p_pkt_get_location(const struct p_packet * packet);
00092 
00098 LIBPARTICLE_API const uint8_t *p_pkt_get_srcid(const struct p_packet * packet);
00099 
00106 LIBPARTICLE_API uint8_t  p_pkt_get_seq(const struct p_packet * packet);
00107 
00114 LIBPARTICLE_API int p_pkt_get_ack(const struct p_packet * packet);
00115 
00122 LIBPARTICLE_API size_t p_pkt_get_payload_length(struct p_packet *packet);
00123 
00132 LIBPARTICLE_API char *p_pkt_get_location_str(const struct p_packet * packet, char * buffer, size_t maxlen);
00133 
00142 LIBPARTICLE_API char *p_pkt_get_srcid_str(const struct p_packet * packet, char * buffer, size_t maxlen);
00143 
00150 LIBPARTICLE_API int p_pkt_set_location(struct p_packet * packet, const uint8_t * location);
00151 
00158 LIBPARTICLE_API int p_pkt_set_srcid(struct p_packet * packet, const uint8_t * source);
00159 
00168 LIBPARTICLE_API int p_pkt_set_seq(struct p_packet * packet, const uint8_t seq);
00169 
00176 LIBPARTICLE_API int p_pkt_set_location_str(struct p_packet * packet, const char * location);
00177 
00187 LIBPARTICLE_API int p_pkt_set_srcid_str(struct p_packet * packet, const char * source);
00188 
00194 LIBPARTICLE_API void p_describe_pkt(const struct p_packet * packet);
00195 
00203 LIBPARTICLE_API char * p_pkt_get_payload(const struct p_packet *pkt, char *buf, size_t *len);
00204 
00213 LIBPARTICLE_API int p_pkt_set_payload(struct p_packet *pkt, const char *data, size_t len);
00214 
00215 /* 
00216  * @{*/
00217 struct p_acl_tuple;
00223 LIBPARTICLE_API struct p_acl_tuple *p_acl_first(const struct p_packet * packet);
00224 
00232 LIBPARTICLE_API struct p_acl_tuple *p_acl_next(const struct p_packet * packet, const struct p_acl_tuple * acl_tuple);
00233 
00242 LIBPARTICLE_API int p_acl_findfirst(const struct p_packet * packet, const uint8_t * acl_type, struct p_acl_tuple ** found_tuple);
00243 
00252 LIBPARTICLE_API int p_acl_findfirst_str(const struct p_packet * packet, const char * acl_type, struct p_acl_tuple ** found_tuple);
00253 
00265 LIBPARTICLE_API int p_acl_findnext(const struct p_packet * packet, struct p_acl_tuple * current_tuple, struct p_acl_tuple ** found_tuple);
00266 
00275 LIBPARTICLE_API int p_acl_add_tuple(struct p_packet *pkt, struct p_acl_tuple *acl, int may_frag);
00276 
00289 LIBPARTICLE_API int p_acl_add(struct p_packet * pkt, const uint8_t * type, const uint8_t * data, size_t len, int may_frag);
00290 
00301 LIBPARTICLE_API int p_acl_add_str(struct p_packet *pkt, const char *type_str, const uint8_t *data, size_t len, int may_frag);
00302 
00311 LIBPARTICLE_API struct p_acl_tuple *p_acl_new(const uint8_t *type, const uint8_t *data, size_t len );
00312 
00322 LIBPARTICLE_API struct p_acl_tuple *p_acl_new_str(const char *type_str, const uint8_t *data, size_t len);
00323 
00330 LIBPARTICLE_API ssize_t p_acl_get_data(const struct p_acl_tuple * acl, uint8_t ** data) ;
00331 
00337 LIBPARTICLE_API ssize_t p_acl_get_len(const struct p_acl_tuple *acl);
00338 
00344 LIBPARTICLE_API const uint8_t * p_acl_get_type(const struct p_acl_tuple * acl) ;
00345 
00352 LIBPARTICLE_API char * p_acl_get_type_str(const struct p_acl_tuple *acl, char *buf);
00353 
00362 LIBPARTICLE_API struct p_acl_tuple* p_acl_dup(const struct p_acl_tuple* acl);
00363 
00375 LIBPARTICLE_API uint8_t p_acl_cmp(const struct p_acl_tuple *first, const struct p_acl_tuple *second);
00378 
00379 #endif /* _PACKET_H_ */

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