Changeset 39e141f for lib/trace.c


Ignore:
Timestamp:
04/21/06 10:28:36 (16 years ago)
Author:
Perry Lorier <perry@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
222d8f5
Parents:
d0906e7
Message:

Merge windows portability fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace.c

    r9e46ee7 r39e141f  
    203203 * and then prints out the help() function registered with each input module
    204204 */
    205 void trace_help() {
     205DLLEXPORT void trace_help() {
    206206        struct libtrace_format_t *tmp;
    207207        printf("libtrace %s\n",PACKAGE_VERSION);
     
    221221 *
    222222 */
    223 SIMPLE_FUNCTION
     223DLLEXPORT SIMPLE_FUNCTION
    224224char *trace_get_output_format(const struct libtrace_out_t *libtrace) {
    225225        char * format = libtrace->format->name;
     
    252252 * and an error is output to stdout.
    253253 */
    254 struct libtrace_t *trace_create(const char *uri) {
     254DLLEXPORT struct libtrace_t *trace_create(const char *uri) {
    255255        struct libtrace_t *libtrace =
    256256                        (struct libtrace_t *)malloc(sizeof(struct libtrace_t));
     
    328328 * libtrace_packet_t's that are not associated with a libtrace_t structure.
    329329 */
    330 struct libtrace_t * trace_create_dead (const char *uri) {
     330DLLEXPORT struct libtrace_t * trace_create_dead (const char *uri) {
    331331        struct libtrace_t *libtrace = (struct libtrace_t *)
    332332                                        malloc(sizeof(struct libtrace_t));
     
    375375 */
    376376       
    377 libtrace_out_t *trace_create_output(const char *uri) {
     377DLLEXPORT libtrace_out_t *trace_create_output(const char *uri) {
    378378        libtrace_out_t *libtrace =
    379379                        (libtrace_out_t*)malloc(sizeof(struct libtrace_out_t));
     
    446446 * the trace.  it may fail.
    447447 */
    448 int trace_start(struct libtrace_t *libtrace)
     448DLLEXPORT int trace_start(struct libtrace_t *libtrace)
    449449{
    450450        assert(libtrace);
     
    460460}
    461461
    462 int trace_start_output(libtrace_out_t *libtrace)
     462DLLEXPORT int trace_start_output(libtrace_out_t *libtrace)
    463463{
    464464        assert(libtrace);
     
    474474}
    475475
    476 int trace_pause(libtrace_t *libtrace)
     476DLLEXPORT int trace_pause(libtrace_t *libtrace)
    477477{
    478478        assert(libtrace);
     
    484484}
    485485
    486 int trace_config(libtrace_t *libtrace,
     486DLLEXPORT int trace_config(libtrace_t *libtrace,
    487487                trace_option_t option,
    488488                void *value)
     
    519519 * @author Shane Alcock
    520520 */
    521 int trace_config_output(struct libtrace_out_t *libtrace,
     521DLLEXPORT int trace_config_output(struct libtrace_out_t *libtrace,
    522522                trace_option_output_t option,
    523523                void *value) {
     
    531531 *
    532532 */
    533 void trace_destroy(struct libtrace_t *libtrace) {
     533DLLEXPORT void trace_destroy(struct libtrace_t *libtrace) {
    534534        assert(libtrace);
    535535        if (libtrace->started && libtrace->format->pause_input)
     
    543543
    544544
    545 void trace_destroy_dead(struct libtrace_t *libtrace) {
     545DLLEXPORT void trace_destroy_dead(struct libtrace_t *libtrace) {
    546546        assert(libtrace);
    547547        free(libtrace);
     
    553553 * @author Shane Alcock
    554554 * */
    555 void trace_destroy_output(struct libtrace_out_t *libtrace) {
     555DLLEXPORT void trace_destroy_output(struct libtrace_out_t *libtrace) {
    556556        assert(libtrace);
    557557        libtrace->format->fin_output(libtrace);
     
    560560}
    561561
    562 libtrace_packet_t *trace_create_packet() {
     562DLLEXPORT libtrace_packet_t *trace_create_packet() {
    563563        libtrace_packet_t *packet =
    564564                (libtrace_packet_t*)calloc(1,sizeof(libtrace_packet_t));
     
    567567}
    568568
    569 libtrace_packet_t *trace_copy_packet(const libtrace_packet_t *packet) {
     569DLLEXPORT libtrace_packet_t *trace_copy_packet(const libtrace_packet_t *packet) {
    570570        libtrace_packet_t *dest =
    571571                (libtrace_packet_t *)malloc(sizeof(libtrace_packet_t));
     
    590590 * sideeffect: sets packet to NULL
    591591 */
    592 void trace_destroy_packet(struct libtrace_packet_t **packet) {
     592DLLEXPORT void trace_destroy_packet(struct libtrace_packet_t **packet) {
    593593        if ((*packet)->buf_control == TRACE_CTRL_PACKET) {
    594594                free((*packet)->buffer);
     
    605605 *
    606606 */
    607 int trace_read_packet(libtrace_t *libtrace, libtrace_packet_t *packet) {
     607DLLEXPORT int trace_read_packet(libtrace_t *libtrace, libtrace_packet_t *packet) {
    608608
    609609        assert(libtrace && "You called trace_read_packet() with a NULL libtrace parameter!\n");
     
    652652 * @author Shane Alcock
    653653 * */
    654 int trace_write_packet(struct libtrace_out_t *libtrace, const struct libtrace_packet_t *packet) {
     654DLLEXPORT int trace_write_packet(struct libtrace_out_t *libtrace, const struct libtrace_packet_t *packet) {
    655655        assert(libtrace);
    656656        assert(packet);
     
    666666}
    667667
    668 void *trace_get_link(const struct libtrace_packet_t *packet) {
     668DLLEXPORT void *trace_get_link(const struct libtrace_packet_t *packet) {
    669669        return (void *)packet->payload;
    670670}
     
    686686 * @author Daniel Lawson
    687687 */
    688 uint64_t trace_get_erf_timestamp(const libtrace_packet_t *packet) {
     688DLLEXPORT uint64_t trace_get_erf_timestamp(const libtrace_packet_t *packet) {
    689689        uint64_t timestamp = 0;
    690690        double seconds = 0.0;
     
    717717 * @author Perry Lorier
    718718 */
    719 struct timeval trace_get_timeval(const libtrace_packet_t *packet) {
     719DLLEXPORT struct timeval trace_get_timeval(const libtrace_packet_t *packet) {
    720720        struct timeval tv;
    721721        uint64_t ts = 0;
     
    755755 * @author Perry Lorier
    756756 */
    757 double trace_get_seconds(const struct libtrace_packet_t *packet) {
     757DLLEXPORT double trace_get_seconds(const struct libtrace_packet_t *packet) {
    758758        double seconds = 0.0;
    759759        uint64_t ts = 0;
     
    778778}
    779779
    780 size_t trace_get_capture_length(const libtrace_packet_t *packet) {
     780DLLEXPORT size_t trace_get_capture_length(const libtrace_packet_t *packet) {
    781781
    782782        assert(packet->size<65536);
     
    797797 * not be the same as the Capture Len.
    798798 */
    799 size_t trace_get_wire_length(const libtrace_packet_t *packet){
     799DLLEXPORT size_t trace_get_wire_length(const libtrace_packet_t *packet){
    800800        assert(packet->size>0 && packet->size<65536);
    801801
     
    815815 * captured packet in memory, and the captured length of the packet
    816816 */
    817 SIMPLE_FUNCTION
     817DLLEXPORT SIMPLE_FUNCTION
    818818size_t trace_get_framing_length(const libtrace_packet_t *packet) {
    819819        if (packet->trace->format->get_framing_length) {
     
    830830 * @author Daniel Lawson
    831831 */
    832 libtrace_linktype_t trace_get_link_type(const libtrace_packet_t *packet ) {
     832DLLEXPORT libtrace_linktype_t trace_get_link_type(const libtrace_packet_t *packet ) {
    833833        if (packet->trace->format->get_link_type) {
    834834                return packet->trace->format->get_link_type(packet);
     
    849849 * @author Perry Lorier
    850850 */
    851 struct libtrace_eventobj_t trace_event(struct libtrace_t *trace,
     851DLLEXPORT struct libtrace_eventobj_t trace_event(struct libtrace_t *trace,
    852852                struct libtrace_packet_t *packet) {
    853853        struct libtrace_eventobj_t event = {TRACE_EVENT_IOWAIT,0,0.0,0};
     
    876876 * @author Daniel Lawson
    877877 */
    878 struct libtrace_filter_t *trace_bpf_setfilter(const char *filterstring) {
     878DLLEXPORT struct libtrace_filter_t *trace_bpf_setfilter(const char *filterstring) {
    879879#if HAVE_BPF
    880880        struct libtrace_filter_t *filter = (struct libtrace_filter_t*)
     
    944944}
    945945
    946 int trace_bpf_filter(struct libtrace_filter_t *filter,
     946DLLEXPORT int trace_bpf_filter(struct libtrace_filter_t *filter,
    947947                        const struct libtrace_packet_t *packet) {
    948948#if HAVE_BPF
     
    978978 * @author Daniel Lawson
    979979 */
    980 int8_t trace_set_direction(struct libtrace_packet_t *packet, int8_t direction) {
     980DLLEXPORT int8_t trace_set_direction(struct libtrace_packet_t *packet, int8_t direction) {
    981981        assert(packet);
    982982        assert(packet->size>0 && packet->size<65536);
     
    996996 * @author Daniel Lawson
    997997 */
    998 int8_t trace_get_direction(const struct libtrace_packet_t *packet) {
     998DLLEXPORT int8_t trace_get_direction(const struct libtrace_packet_t *packet) {
    999999        assert(packet);
    10001000        assert(packet->size>0 && packet->size<65536);
     
    10201020 * @author Daniel Lawson
    10211021 */
    1022 int8_t trace_get_server_port(uint8_t protocol UNUSED, uint16_t source, uint16_t dest) {
     1022DLLEXPORT int8_t trace_get_server_port(uint8_t protocol UNUSED, uint16_t source, uint16_t dest) {
    10231023        /*
    10241024         * * If the ports are equal, return DEST
     
    11301130 * @author Daniel Lawson
    11311131 */
    1132 size_t trace_set_capture_length(struct libtrace_packet_t *packet, size_t size) {
     1132DLLEXPORT size_t trace_set_capture_length(struct libtrace_packet_t *packet, size_t size) {
    11331133        assert(packet);
    11341134        assert(packet->size>0 && packet->size<65536);
     
    11451145}
    11461146
    1147 const char * trace_parse_uri(const char *uri, char **format) {
     1147DLLEXPORT const char * trace_parse_uri(const char *uri, char **format) {
    11481148        const char *uridata = 0;
    11491149       
     
    11731173}
    11741174       
    1175 libtrace_err_t trace_get_err(libtrace_t *trace)
     1175DLLEXPORT libtrace_err_t trace_get_err(libtrace_t *trace)
    11761176{
    11771177        libtrace_err_t err = trace->err;
     
    11811181}
    11821182
    1183 bool trace_is_err(libtrace_t *trace)
     1183DLLEXPORT bool trace_is_err(libtrace_t *trace)
    11841184{
    11851185        return trace->err.err_num != 0;
    11861186}
    11871187
    1188 void trace_perror(libtrace_t *trace,const char *msg,...)
     1188DLLEXPORT void trace_perror(libtrace_t *trace,const char *msg,...)
    11891189{
    11901190        char buf[256];
     
    12021202}
    12031203
    1204 libtrace_err_t trace_get_err_output(libtrace_out_t *trace)
     1204DLLEXPORT libtrace_err_t trace_get_err_output(libtrace_out_t *trace)
    12051205{
    12061206        libtrace_err_t err = trace->err;
     
    12101210}
    12111211
    1212 bool trace_is_err_output(libtrace_out_t *trace)
     1212DLLEXPORT bool trace_is_err_output(libtrace_out_t *trace)
    12131213{
    12141214        return trace->err.err_num != 0;
    12151215}
    12161216
    1217 void trace_perror_output(libtrace_out_t *trace,const char *msg,...)
     1217DLLEXPORT void trace_perror_output(libtrace_out_t *trace,const char *msg,...)
    12181218{
    12191219        char buf[256];
     
    12301230}
    12311231
    1232 int trace_seek_erf_timestamp(libtrace_t *trace, uint64_t ts)
     1232DLLEXPORT int trace_seek_erf_timestamp(libtrace_t *trace, uint64_t ts)
    12331233{
    12341234        if (trace->format->seek_erf) {
     
    12641264}
    12651265
    1266 int trace_seek_seconds(libtrace_t *trace, double seconds)
     1266DLLEXPORT int trace_seek_seconds(libtrace_t *trace, double seconds)
    12671267{
    12681268        if (trace->format->seek_seconds) {
     
    12891289}
    12901290
    1291 int trace_seek_timeval(libtrace_t *trace, struct timeval tv)
     1291DLLEXPORT int trace_seek_timeval(libtrace_t *trace, struct timeval tv)
    12921292{
    12931293        if (trace->format->seek_timeval) {
     
    13111311}
    13121312
    1313 char *trace_ether_ntoa(const uint8_t *addr, char *buf)
     1313DLLEXPORT char *trace_ether_ntoa(const uint8_t *addr, char *buf)
    13141314{
    13151315        char *buf2 = buf;
     
    13231323}
    13241324
    1325 uint8_t *trace_ether_aton(const char *buf, uint8_t *addr)
     1325DLLEXPORT uint8_t *trace_ether_aton(const char *buf, uint8_t *addr)
    13261326{
    13271327        uint8_t *buf2 = addr;
Note: See TracChangeset for help on using the changeset viewer.