00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
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