Changeset 58c226e
- Timestamp:
- 02/05/19 15:12:49 (2 years ago)
- Branches:
- develop
- Children:
- 4e5a51f
- Parents:
- 7b4f5e2
- Location:
- lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_pktmeta.c
r7b4f5e2 r58c226e 21 21 } 22 22 23 /* API functions to retrieve interface related packet data */ 24 25 /* Destroy libtrace_meta_t structure 26 * 27 * @params libtrace_meta_t structure 28 * returns 1 on success, -1 on failure 29 */ 30 int trace_destroy_meta(libtrace_meta_t *result) { 31 int i; 32 if (!result) { return -1; } 33 34 for (i=0;i<result->num;i++) { 35 if(result->items[i].data != NULL) { 36 free(result->items[i].data); 37 } 38 } 39 if (result->items) { 40 free(result->items); 41 } 42 if (result) { 43 free(result); 44 } 45 46 return 1; 47 } 48 49 libtrace_meta_t *trace_get_meta_option(libtrace_packet_t *packet, uint32_t section, 23 static libtrace_meta_t *trace_get_meta_option(libtrace_packet_t *packet, uint32_t section, 50 24 uint32_t option) { 51 25 … … 120 94 } 121 95 122 /* Get the interface name/s for a meta packet. 123 * Must be destroyed with trace_destroy_meta(). 124 * 125 * @params libtrace_packet_t meta packet. 126 * @returns Pointer to libtrace_meta_t structure containing all found interface names 127 * or NULL. 128 */ 96 97 /* API FUNCTIONS */ 98 99 int trace_destroy_meta(libtrace_meta_t *result) { 100 int i; 101 if (!result) { return -1; } 102 103 for (i=0;i<result->num;i++) { 104 if(result->items[i].data != NULL) { 105 free(result->items[i].data); 106 } 107 } 108 if (result->items) { 109 free(result->items); 110 } 111 if (result) { 112 free(result); 113 } 114 115 return 1; 116 } 117 129 118 libtrace_meta_t *trace_get_interface_name_meta(libtrace_packet_t *packet) { 130 119 if (trace_meta_check_input(packet, "trace_get_interface_name()")<0) { … … 144 133 return r; 145 134 } 146 /* Get the interface name for a meta packet. 147 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to 148 * specify the interface index. 149 * 150 * @params libtrace_packet_t meta packet to extract the interface name from. 151 * @params A pointer to a character buffer to store the interface name in. 152 * @params The size of the buffer passed in. 153 * @params The interface index within the meta packet. 154 * @returns Pointer to the character buffer containing the interface name or NULL. 155 */ 135 156 136 char *trace_get_interface_name(libtrace_packet_t *packet, char *space, int spacelen, 157 137 int index) { … … 177 157 } 178 158 179 /* Get the interface MAC address/s for a meta packet.180 * Must be destroyed with trace_destroy_meta().181 *182 * @params libtrace_packet_t meta packet.183 * @returns Pointer to libtrace_meta_t structure containing all found interface mac184 * addresses or NULL.185 */186 159 libtrace_meta_t *trace_get_interface_mac_meta(libtrace_packet_t *packet) { 187 160 if (trace_meta_check_input(packet, "trace_get_interface_mac()")<0) { … … 200 173 return r; 201 174 } 202 /* Get the interface MAC address for a meta packet. 203 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to 204 * specify the interface index. 205 * 206 * @params libtrace_packet_t meta packet to extract the MAC address from. 207 * @params A pointer to a character buffer to store the MAC address in. 208 * @params The size of the buffer passed in. 209 * @params The interface index within the meta packet. 210 * @returns Pointer to the character buffer containing the MAC address or NULL. 211 */ 175 212 176 char *trace_get_interface_mac(libtrace_packet_t *packet, char *space, int spacelen, 213 177 int index) { … … 230 194 } 231 195 232 /* Get the interface speed/s from a meta packet.233 * Must be destroyed with trace_destroy_meta().234 *235 * @params libtrace_packet_t packet.236 * @returns Pointer to libtrace_meta_t structure containing all found interface237 * speeds or NULL.238 */239 196 libtrace_meta_t *trace_get_interface_speed_meta(libtrace_packet_t *packet) { 240 197 if (trace_meta_check_input(packet, "trace_get_interface_speed()")<0) { … … 253 210 return r; 254 211 } 255 /* Get the interface speed for a meta packet. 256 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to 257 * specify the interface index. 258 * 259 * @params libtrace_packet_t meta packet to extract the interface speed from. 260 * @params The interface index within the meta packet. 261 * @returns uint64_t interface speed or NULL. 262 */ 212 263 213 uint64_t trace_get_interface_speed(libtrace_packet_t *packet, int index) { 264 214 libtrace_meta_t *r = trace_get_interface_speed_meta(packet); … … 275 225 } 276 226 277 /* Get the interface ipv4 address/s for a meta packet.278 * Must be destroyed with trace_destroy_meta().279 *280 * @params libtrace_packet_t meta packet.281 * @returns Pointer to libtrace_meta_t structure containing all found ipv4 addresses282 * or NULL283 */284 227 libtrace_meta_t *trace_get_interface_ipv4_meta(libtrace_packet_t *packet) { 285 228 if (trace_meta_check_input(packet, "trace_get_interface_ip4()")<0) { … … 298 241 return r; 299 242 } 300 /* Get the interface ipv4 address for a meta packet. 301 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to 302 * specify the interface index. 303 * 304 * @params libtrace_packet_t meta packet to extract the ipv4 address from. 305 * @params The interface index within the meta packet. 306 * @returns uint32_t ipv4 address or 0. 307 */ 243 308 244 uint32_t trace_get_interface_ipv4(libtrace_packet_t *packet, int index) { 309 245 libtrace_meta_t *r = trace_get_interface_ipv4_meta(packet); … … 317 253 return data; 318 254 } 319 /* Get the interface ipv4 address string for a meta packet. 320 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to 321 * specify the interface index. 322 * 323 * @params libtrace_packet_t meta packet to extract the ipv4 address from. 324 * @params The interface index within the meta packet. 325 * @returns Pointer to the character buffer containing the ipv4 address string or NULL. 326 */ 255 327 256 /* UNTESTED */ 328 char *trace_get_interface_ipv4_string(libtrace_packet_t *packet, int index) { 329 struct in_addr ip; 330 uint32_t addr; 331 332 addr = trace_get_interface_ipv4(packet, index); 333 if (addr == 0) { return NULL; } 334 335 ip.s_addr = addr; 336 337 return inet_ntoa(ip); 338 } 339 340 /* Get the interface ipv6 address/s for a meta packet. 341 * Must be destroyed with trace_destroy_meta(). 342 * 343 * @params libtrace_packet_t meta packet. 344 * @returns Pointer to libtrace_meta_t structure containing all found ipv6 addresses 345 * or NULL. 346 */ 257 char *trace_get_interface_ipv4_string(libtrace_packet_t *packet, char *space, int spacelen, 258 int index) { 259 260 if (spacelen < INET_ADDRSTRLEN) { 261 return NULL; 262 } 263 264 uint32_t addr = trace_get_interface_ipv4(packet, index); 265 if (addr == 0) { 266 return NULL; 267 } 268 269 /* get the string representation, store in space */ 270 inet_ntop(AF_INET, &addr, space, INET_ADDRSTRLEN); 271 272 return space; 273 } 274 347 275 libtrace_meta_t *trace_get_interface_ipv6_meta(libtrace_packet_t *packet) { 348 276 if (trace_meta_check_input(packet, "trace_get_interface_ip6()")<0) { … … 361 289 return r; 362 290 } 363 /* Get the interface ipv6 address for a meta packet. 364 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to 365 * specify the interface index. 366 * 367 * @params libtrace_packet_t meta packet to extract the ipv6 address from. 368 * @params A pointer to a character buffer to store the ipv6 address in. 369 * @params The size of the buffer passed in. 370 * @params The interface index within the meta packet. 371 * @returns Pointer to the buffer containing the ipv6 address or NULL. 372 */ 291 373 292 void *trace_get_interface_ipv6(libtrace_packet_t *packet, void *space, int spacelen, 374 293 int index) { … … 388 307 return space; 389 308 } 390 /* Get the interface ipv6 address string for a meta packet. 391 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to 392 * specify the interface index. 393 * 394 * @params libtrace_packet_t meta packet to extract the ipv6 address from. 395 * @params A pointer to a character buffer to store the ipv6 address in. 396 * @params The size of the buffer passed in. 397 * @params The interface index within the meta packet. 398 * @returns Pointer to the character buffer containing the ipv6 address string or NULL. 399 */ 309 400 310 /* UNTESTED */ 401 311 char *trace_get_interface_ipv6_string(libtrace_packet_t *packet, char *space, int spacelen, … … 414 324 } 415 325 416 /* get the string representation */326 /* get the string representation, store in space */ 417 327 inet_ntop(AF_INET6, &(sa.sin6_addr), space, INET6_ADDRSTRLEN); 418 328 … … 420 330 } 421 331 422 423 /* Get the interface description/s for a meta packet.424 * Must be destroyed with trace_destroy_meta().425 *426 * @params libtrace_packet_t meta packet.427 * @returns Pointer to libtrace_meta_t structure containing all found interface428 * descriptions or NULL.429 */430 332 libtrace_meta_t *trace_get_interface_description_meta(libtrace_packet_t *packet) { 431 333 if (trace_meta_check_input(packet, "trace_get_interface_description()")<0) { … … 444 346 return r; 445 347 } 446 /* Get the interface description for a meta packet. 447 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to 448 * specify the interface index. 449 * 450 * @params libtrace_packet_t meta packet to extract the interface description from. 451 * @params A pointer to a character buffer to store the interface description in. 452 * @params The size of the buffer passed in. 453 * @params The interface index within the meta packet. 454 * @returns Pointer to the character buffer containing the interface description or NULL. 455 */ 348 456 349 char *trace_get_interface_description(libtrace_packet_t *packet, char *space, int spacelen, 457 350 int index) { … … 474 367 } 475 368 476 477 /* Get the host OS for a meta packet.478 * Must be destroyed with trace_destroy_meta().479 *480 * @params libtrace_packet_t meta packet.481 * @returns Pointer to libtrace_meta_t structure containing the host OS or NULL.482 */483 369 libtrace_meta_t *trace_get_host_os_meta(libtrace_packet_t *packet) { 484 370 if (trace_meta_check_input(packet, "trace_get_host_os()")<0) { … … 497 383 return r; 498 384 } 499 /* Get the host OS for a meta packet. 500 * 501 * @params libtrace_packet_t meta packet to extract the host OS from. 502 * @params A pointer to a character buffer to store the host OS in. 503 * @params The size of the buffer passed in. 504 * @returns Pointer to the character buffer containing the host OS or NULL. 505 */ 385 506 386 char *trace_get_host_os(libtrace_packet_t *packet, char *space, int spacelen) { 507 387 libtrace_meta_t *r = trace_get_host_os_meta(packet); … … 518 398 } 519 399 520 /* Get the interface frame check sequence length for a meta packet.521 * Must be destroyed with trace_destroy_meta().522 *523 * @params libtrace_packet_t meta packet.524 * @returns Pointer to libtrace_meta_t structure containing all found frame check525 * sequence lengths or NULL.526 */527 400 libtrace_meta_t *trace_get_interface_fcslen_meta(libtrace_packet_t *packet) { 528 401 if (trace_meta_check_input(packet, "trace_get_interface_frame_check_sequence_length()")<0) { … … 541 414 return r; 542 415 } 543 /* Get the interface frame check sequence length for a meta packet. 544 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to 545 * specify the interface index. 546 * 547 * @params libtrace_packet_t meta packet to extract the interface fcslen from. 548 * @params The interface index within the meta packet. 549 * @returns uint32_t frame check sequence length or 0. 550 */ 416 551 417 uint32_t trace_get_interface_fcslen(libtrace_packet_t *packet, int index) { 552 418 libtrace_meta_t *r = trace_get_interface_fcslen_meta(packet); … … 561 427 } 562 428 563 /* Get any interface comments for a meta packet564 * Must be destroyed with trace_destroy_meta()565 *566 * @params libtrace_packet_t packet567 * @returns Pointer to libtrace_meta_t structure or NULL568 */569 429 libtrace_meta_t *trace_get_interface_comment_meta(libtrace_packet_t *packet) { 570 430 if (trace_meta_check_input(packet, "trace_get_interface_comment()")<0) { … … 583 443 return r; 584 444 } 585 /* Get the interface comment for a meta packet. 586 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to 587 * specify the interface ID. 588 * 589 * @params libtrace_packet_t meta packet to extract the interface comment from. 590 * @params A pointer to a character buffer to store the interface description in. 591 * @params The size of the buffer passed in. 592 * @params The interface number within the meta packet. 593 * @returns Pointer to the character buffer containing the hardware description or NULL. 594 */ 445 595 446 char *trace_get_interface_comment(libtrace_packet_t *packet, char *space, int spacelen, 596 447 int index) { … … 613 464 } 614 465 615 /* Get the capture application for a meta packet616 * Must be destroyed with trace_destroy_meta()617 *618 * @params libtrace_packet_t packet619 * @returns Pointer to libtrace_meta_t structure or NULL620 */621 466 libtrace_meta_t *trace_get_capture_application_meta(libtrace_packet_t *packet) { 622 467 if (trace_meta_check_input(packet, "trace_get_interface_comment()")<0) { … … 635 480 return r; 636 481 } 637 /* Get the capture application for a meta packet. 638 * 639 * @params libtrace_packet_t meta packet to extract the application name from. 640 * @params A pointer to a character buffer to store the application name in. 641 * @params The size of the buffer passed in. 642 * @returns Pointer to the character buffer containing the application name or NULL. 643 */ 482 644 483 char *trace_get_capture_application(libtrace_packet_t *packet, char *space, int spacelen) { 645 484 libtrace_meta_t *r = trace_get_capture_application_meta(packet); … … 656 495 } 657 496 658 /* Get a meta section option from a meta packet659 * Must be destroyed with trace_destroy_meta()660 *661 * @params libtrace_packet_t packet662 * @params Section code663 * @params Option code664 * @returns Pointer to libtrace_meta_t structure or NULL665 */666 497 libtrace_meta_t *trace_get_section_option(libtrace_packet_t *packet, uint32_t section_code, 667 498 uint16_t option_code) { … … 674 505 } 675 506 676 /* Get a section from a meta packet677 * Must be destroyed with trace_destroy_meta()678 *679 * @params libtrace_packet_t packet680 * @params Section code681 * @returns Pointer to libtrace_meta_t structure or NULL682 */683 507 libtrace_meta_t *trace_get_section(libtrace_packet_t *packet, uint32_t section_code) { 684 508 if (trace_meta_check_input(packet, "trace_get_section()")<0) { … … 689 513 } 690 514 691 /* ERF specific function */692 /* Get the DAG card model from a meta packet.693 *694 * @params libtrace_packet_t meta packet to extract the DAG model from.695 * @params A pointer to a character buffer to store the DAG model in.696 * @params The size of the buffer passed in.697 * @returns Pointer to the character buffer containing the DAG model or NULL.698 */699 515 char *trace_get_erf_dag_card_model(libtrace_packet_t *packet, char *space, int spacelen) { 700 516 libtrace_meta_t *r = trace_get_section_option(packet, ERF_PROV_SECTION_MODULE, … … 712 528 return space; 713 529 } 714 /* Get the host DAG software version for a meta packet. 715 * 716 * @params libtrace_packet_t meta packet to extract the hosts DAG verion from. 717 * @params A pointer to a character buffer to store the DAG version in. 718 * @params The size of the buffer passed in. 719 * @returns Pointer to the character buffer containing the DAG version or NULL. 720 */ 530 721 531 char *trace_get_erf_dag_version(libtrace_packet_t *packet, char *space, int spacelen) { 722 532 libtrace_meta_t *r = trace_get_section_option(packet, ERF_PROV_SECTION_MODULE, … … 735 545 return space; 736 546 } 737 /* Get the firmware version for a DAG module from a meta packet. 738 * 739 * @params libtrace_packet_t meta packet to extract the FW version from. 740 * @params A pointer to a character buffer to store the FW version in. 741 * @params The size of the buffer passed in. 742 * @returns Pointer to the character buffer containing the FW version or NULL. 743 */ 547 744 548 char *trace_get_erf_dag_fw_version(libtrace_packet_t *packet, char *space, int spacelen) { 745 549 libtrace_meta_t *r = trace_get_section_option(packet, ERF_PROV_SECTION_MODULE, -
lib/libtrace.h.in
r7b4f5e2 r58c226e 3725 3725 /*@}*/ 3726 3726 3727 /* Destroy libtrace_meta_t structure 3728 * 3729 * @params libtrace_meta_t structure 3730 * returns 1 on success, -1 on failure 3731 */ 3727 3732 DLLEXPORT int trace_destroy_meta(libtrace_meta_t *result); 3728 3733 3729 DLLEXPORT libtrace_meta_t *trace_get_meta_option(libtrace_packet_t *packet, uint32_t section, 3730 uint32_t option); 3731 3734 /* Get the interface name/s for a meta packet. 3735 * Must be destroyed with trace_destroy_meta(). 3736 * 3737 * @params libtrace_packet_t meta packet. 3738 * @returns Pointer to libtrace_meta_t structure containing all found interface names 3739 * or NULL. 3740 */ 3732 3741 DLLEXPORT libtrace_meta_t *trace_get_interface_name_meta(libtrace_packet_t *packet); 3733 3742 3743 /* Get the interface name for a meta packet. 3744 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to 3745 * specify the interface index. 3746 * 3747 * @params libtrace_packet_t meta packet to extract the interface name from. 3748 * @params A pointer to a character buffer to store the interface name in. 3749 * @params The size of the buffer passed in. 3750 * @params The interface index within the meta packet. 3751 * @returns Pointer to the character buffer containing the interface name or NULL. 3752 */ 3734 3753 DLLEXPORT char *trace_get_interface_name(libtrace_packet_t *packet, char *space, int spacelen, 3735 3754 int index); 3736 3755 3756 /* Get the interface MAC address/s for a meta packet. 3757 * Must be destroyed with trace_destroy_meta(). 3758 * 3759 * @params libtrace_packet_t meta packet. 3760 * @returns Pointer to libtrace_meta_t structure containing all found interface mac 3761 * addresses or NULL. 3762 */ 3737 3763 DLLEXPORT libtrace_meta_t *trace_get_interface_mac_meta(libtrace_packet_t *packet); 3738 3764 3765 /* Get the interface MAC address for a meta packet. 3766 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to 3767 * specify the interface index. 3768 * 3769 * @params libtrace_packet_t meta packet to extract the MAC address from. 3770 * @params A pointer to a character buffer to store the MAC address in. 3771 * @params The size of the buffer passed in. 3772 * @params The interface index within the meta packet. 3773 * @returns Pointer to the character buffer containing the MAC address or NULL. 3774 */ 3739 3775 DLLEXPORT char *trace_get_interface_mac(libtrace_packet_t *packet, char *space, int spacelen, 3740 3776 int index); 3741 3777 3778 /* Get the interface speed/s from a meta packet. 3779 * Must be destroyed with trace_destroy_meta(). 3780 * 3781 * @params libtrace_packet_t packet. 3782 * @returns Pointer to libtrace_meta_t structure containing all found interface 3783 * speeds or NULL. 3784 */ 3742 3785 DLLEXPORT libtrace_meta_t *trace_get_interface_speed_meta(libtrace_packet_t *packet); 3743 3786 3787 /* Get the interface speed for a meta packet. 3788 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to 3789 * specify the interface index. 3790 * 3791 * @params libtrace_packet_t meta packet to extract the interface speed from. 3792 * @params The interface index within the meta packet. 3793 * @returns uint64_t interface speed or NULL. 3794 */ 3744 3795 DLLEXPORT uint64_t trace_get_interface_speed(libtrace_packet_t *packet, int index); 3745 3796 3746 3797 /* Get the interface ipv4 address/s for a meta packet. 3798 * Must be destroyed with trace_destroy_meta(). 3799 * 3800 * @params libtrace_packet_t meta packet. 3801 * @returns Pointer to libtrace_meta_t structure containing all found ipv4 addresses 3802 * or NULL 3803 */ 3747 3804 DLLEXPORT libtrace_meta_t *trace_get_interface_ipv4_meta(libtrace_packet_t *packet); 3748 3805 3806 /* Get the interface ipv4 address for a meta packet. 3807 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to 3808 * specify the interface index. 3809 * 3810 * @params libtrace_packet_t meta packet to extract the ipv4 address from. 3811 * @params The interface index within the meta packet. 3812 * @returns uint32_t ipv4 address or 0. 3813 */ 3749 3814 DLLEXPORT uint32_t trace_get_interface_ipv4(libtrace_packet_t *packet, int index); 3750 3815 3751 DLLEXPORT char *trace_get_interface_ipv4_string(libtrace_packet_t *packet, int index); 3752 3816 /* Get the interface ipv4 address string for a meta packet. 3817 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to 3818 * specify the interface index. 3819 * 3820 * @params libtrace_packet_t meta packet to extract the ipv4 address from. 3821 * @params A pointer to a character buffer to store the ipv4 address string in. 3822 * @params The size of the buffer passed in. 3823 * @params The interface index within the meta packet. 3824 * @returns Pointer to the character buffer containing the ipv4 address string or NULL. 3825 */ 3826 DLLEXPORT char *trace_get_interface_ipv4_string(libtrace_packet_t *packet, char* space, int spacelen, 3827 int index); 3828 3829 /* Get the interface ipv6 address/s for a meta packet. 3830 * Must be destroyed with trace_destroy_meta(). 3831 * 3832 * @params libtrace_packet_t meta packet. 3833 * @returns Pointer to libtrace_meta_t structure containing all found ipv6 addresses 3834 * or NULL. 3835 */ 3753 3836 DLLEXPORT libtrace_meta_t *trace_get_interface_ipv6_meta(libtrace_packet_t *packet); 3754 3837 3838 /* Get the interface ipv6 address for a meta packet. 3839 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to 3840 * specify the interface index. 3841 * 3842 * @params libtrace_packet_t meta packet to extract the ipv6 address from. 3843 * @params A pointer to a character buffer to store the ipv6 address in. 3844 * @params The size of the buffer passed in. 3845 * @params The interface index within the meta packet. 3846 * @returns Pointer to the buffer containing the ipv6 address or NULL. 3847 */ 3755 3848 DLLEXPORT void *trace_get_interface_ipv6(libtrace_packet_t *packet, void *space, int spacelen, 3756 3849 int index); 3757 3850 3851 /* Get the interface ipv6 address string for a meta packet. 3852 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to 3853 * specify the interface index. 3854 * 3855 * @params libtrace_packet_t meta packet to extract the ipv6 address from. 3856 * @params A pointer to a character buffer to store the ipv6 address in. 3857 * @params The size of the buffer passed in. 3858 * @params The interface index within the meta packet. 3859 * @returns Pointer to the character buffer containing the ipv6 address string or NULL. 3860 */ 3758 3861 DLLEXPORT char *trace_get_interface_ipv6_string(libtrace_packet_t *packet, char *space, int spacelen, 3759 3862 int index); 3760 3863 3864 /* Get the interface description/s for a meta packet. 3865 * Must be destroyed with trace_destroy_meta(). 3866 * 3867 * @params libtrace_packet_t meta packet. 3868 * @returns Pointer to libtrace_meta_t structure containing all found interface 3869 * descriptions or NULL. 3870 */ 3761 3871 DLLEXPORT libtrace_meta_t *trace_get_interface_description_meta(libtrace_packet_t *packet); 3762 3872 3873 /* Get the interface description for a meta packet. 3874 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to 3875 * specify the interface index. 3876 * 3877 * @params libtrace_packet_t meta packet to extract the interface description from. 3878 * @params A pointer to a character buffer to store the interface description in. 3879 * @params The size of the buffer passed in. 3880 * @params The interface index within the meta packet. 3881 * @returns Pointer to the character buffer containing the interface description or NULL. 3882 */ 3763 3883 DLLEXPORT char *trace_get_interface_description(libtrace_packet_t *packet, char *space, int spacelen, 3764 3765 3884 int index); 3766 3885 3886 /* Get the host OS for a meta packet. 3887 * Must be destroyed with trace_destroy_meta(). 3888 * 3889 * @params libtrace_packet_t meta packet. 3890 * @returns Pointer to libtrace_meta_t structure containing the host OS or NULL. 3891 */ 3767 3892 DLLEXPORT libtrace_meta_t *trace_get_host_os_meta(libtrace_packet_t *packet); 3768 3893 3894 /* Get the host OS for a meta packet. 3895 * 3896 * @params libtrace_packet_t meta packet to extract the host OS from. 3897 * @params A pointer to a character buffer to store the host OS in. 3898 * @params The size of the buffer passed in. 3899 * @returns Pointer to the character buffer containing the host OS or NULL. 3900 */ 3769 3901 DLLEXPORT char *trace_get_host_os(libtrace_packet_t *packet, char *space, int spacelen); 3770 3902 3903 /* Get the interface frame check sequence length for a meta packet. 3904 * Must be destroyed with trace_destroy_meta(). 3905 * 3906 * @params libtrace_packet_t meta packet. 3907 * @returns Pointer to libtrace_meta_t structure containing all found frame check 3908 * sequence lengths or NULL. 3909 */ 3771 3910 DLLEXPORT libtrace_meta_t *trace_get_interface_fcslen_meta(libtrace_packet_t *packet); 3772 3911 3912 /* Get the interface frame check sequence length for a meta packet. 3913 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to 3914 * specify the interface index. 3915 * 3916 * @params libtrace_packet_t meta packet to extract the interface fcslen from. 3917 * @params The interface index within the meta packet. 3918 * @returns uint32_t frame check sequence length or 0. 3919 */ 3773 3920 DLLEXPORT uint32_t trace_get_interface_fcslen(libtrace_packet_t *packet, int index); 3774 3921 3922 /* Get any interface comments for a meta packet 3923 * Must be destroyed with trace_destroy_meta() 3924 * 3925 * @params libtrace_packet_t packet 3926 * @returns Pointer to libtrace_meta_t structure or NULL 3927 */ 3775 3928 DLLEXPORT libtrace_meta_t *trace_get_interface_comment_meta(libtrace_packet_t *packet); 3776 3929 3930 /* Get the interface comment for a meta packet. 3931 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to 3932 * specify the interface ID. 3933 * 3934 * @params libtrace_packet_t meta packet to extract the interface comment from. 3935 * @params A pointer to a character buffer to store the interface description in. 3936 * @params The size of the buffer passed in. 3937 * @params The interface number within the meta packet. 3938 * @returns Pointer to the character buffer containing the hardware description or NULL. 3939 */ 3777 3940 DLLEXPORT char *trace_get_interface_comment(libtrace_packet_t *packet, char *space, int spacelen, 3778 3941 int index); 3779 3942 3943 /* Get the capture application for a meta packet 3944 * Must be destroyed with trace_destroy_meta() 3945 * 3946 * @params libtrace_packet_t packet 3947 * @returns Pointer to libtrace_meta_t structure or NULL 3948 */ 3780 3949 DLLEXPORT libtrace_meta_t *trace_get_capture_application_meta(libtrace_packet_t *packet); 3781 3950 3951 /* Get the capture application for a meta packet. 3952 * 3953 * @params libtrace_packet_t meta packet to extract the application name from. 3954 * @params A pointer to a character buffer to store the application name in. 3955 * @params The size of the buffer passed in. 3956 * @returns Pointer to the character buffer containing the application name or NULL. 3957 */ 3782 3958 DLLEXPORT char *trace_get_capture_application(libtrace_packet_t *packet, char *space, int spacelen); 3783 3959 3960 /* Get a meta section option from a meta packet 3961 * Must be destroyed with trace_destroy_meta() 3962 * 3963 * @params libtrace_packet_t packet 3964 * @params Section code 3965 * @params Option code 3966 * @returns Pointer to libtrace_meta_t structure or NULL 3967 */ 3784 3968 DLLEXPORT libtrace_meta_t *trace_get_section_option(libtrace_packet_t *packet, uint32_t section_code, 3785 3969 uint16_t option_code); 3786 3970 3971 /* Get a section from a meta packet 3972 * Must be destroyed with trace_destroy_meta() 3973 * 3974 * @params libtrace_packet_t packet 3975 * @params Section code 3976 * @returns Pointer to libtrace_meta_t structure or NULL 3977 */ 3787 3978 DLLEXPORT libtrace_meta_t *trace_get_section(libtrace_packet_t *packet, uint32_t section_code); 3788 3979 3980 /* Get the DAG card model from a meta packet. 3981 * 3982 * @params libtrace_packet_t meta packet to extract the DAG model from. 3983 * @params A pointer to a character buffer to store the DAG model in. 3984 * @params The size of the buffer passed in. 3985 * @returns Pointer to the character buffer containing the DAG model or NULL. 3986 */ 3789 3987 DLLEXPORT char *trace_get_erf_dag_card_model(libtrace_packet_t *packet, char *space, 3790 3988 int spacelen); 3791 3989 3990 /* Get the host DAG software version for a meta packet. 3991 * 3992 * @params libtrace_packet_t meta packet to extract the hosts DAG verion from. 3993 * @params A pointer to a character buffer to store the DAG version in. 3994 * @params The size of the buffer passed in. 3995 * @returns Pointer to the character buffer containing the DAG version or NULL. 3996 */ 3792 3997 DLLEXPORT char *trace_get_erf_dag_version(libtrace_packet_t *packet, char *space, 3793 3998 int spacelen); 3794 3999 4000 /* Get the firmware version for a DAG module from a meta packet. 4001 * 4002 * @params libtrace_packet_t meta packet to extract the FW version from. 4003 * @params A pointer to a character buffer to store the FW version in. 4004 * @params The size of the buffer passed in. 4005 * @returns Pointer to the character buffer containing the FW version or NULL. 4006 */ 3795 4007 DLLEXPORT char *trace_get_erf_dag_fw_version(libtrace_packet_t *packet, char *space, 3796 4008 int spacelen);
Note: See TracChangeset
for help on using the changeset viewer.