Changeset 9c6aa95


Ignore:
Timestamp:
10/07/05 17:31:17 (15 years ago)
Author:
Daniel Lawson <dlawson@…>
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:
9daf398
Parents:
5c88a60
Message:

cleaned up after compiling with -Wall -W

Location:
lib
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • lib/fifo.c

    rb5cd711 r9c6aa95  
    6969
    7070static void increment_pointer(struct tracefifo_t *fifo, enum which_t which, int amount);
    71 static void set_pointer(struct tracefifo_t *fifo, enum which_t which, int location);
     71static void set_pointer(struct tracefifo_t *fifo, enum which_t which, unsigned int location);
    7272static size_t tracefifo_compare(struct tracefifo_t *fifo, enum which_t first, enum which_t second);
    7373static int tracefifo_read_generic(struct tracefifo_t *fifo, void *buffer, size_t len, enum which_t which, char update);
     
    115115}
    116116
    117 void tracefifo_flush(struct tracefifo_t *fifo) {
     117void tracefifo_flush(struct tracefifo_t *fifo __attribute__((unused))) {
    118118        // do nothing
    119119        return;
    120120}
    121121
    122 static void set_pointer(struct tracefifo_t *fifo, enum which_t which, int location) {
     122static void set_pointer(struct tracefifo_t *fifo, enum which_t which, unsigned int location) {
    123123        assert(fifo);
    124124        assert(which == IN || which == OUT || which == ACK);
    125         assert(location >= 0);
    126125
    127126        assert(location <= fifo->length);
     
    212211        assert(fifo);
    213212        assert(buffer);
    214         assert(len >= 0);
    215213
    216214        oldptr = fifo->datamap[which];
     
    237235        assert(fifo);
    238236        assert(buffer);
    239         assert(len >= 0);
    240237
    241238        if (tracefifo_free(fifo) < len) {
     
    260257        assert(fifo);
    261258        assert(buffer);
    262         assert(len >= 0);
    263259        if (tracefifo_compare(fifo,IN,OUT) < len) {
    264260                return 0;
     
    270266        assert(fifo);
    271267        assert(buffer);
    272         assert(len >= 0);
    273268        if (tracefifo_compare(fifo,OUT,ACK) < len) {
    274269                return 0;
     
    279274int tracefifo_out_update(struct tracefifo_t *fifo, size_t len){
    280275        assert(fifo);
    281         assert(len >= 0);
    282276        if (tracefifo_compare(fifo,IN,OUT) < len) {
    283277                return 0;
     
    289283int tracefifo_ack_update(struct tracefifo_t *fifo, size_t len){
    290284        assert(fifo);
    291         assert(len >= 0);
    292285        if (tracefifo_compare(fifo,OUT,ACK) < len) {
    293286                return 0;
  • lib/format_erf.c

    rdfc2673 r9c6aa95  
    2828 *
    2929 */
     30#define _GNU_SOURCE
    3031
    3132#include "config.h"
     
    5859#include <getopt.h>
    5960#include <stdio.h>
     61#include <string.h>
     62#include <stdlib.h>
    6063
    6164/* Catch undefined O_LARGEFILE on *BSD etc */
     
    174177static int erf_init_input(struct libtrace_t *libtrace) {
    175178        struct stat buf;
    176         struct hostent *he;
    177         struct sockaddr_in remote;
    178179        struct sockaddr_un unix_sock;
    179180        libtrace->format_data = (struct libtrace_format_data_t *)
     
    338339                                break;
    339340                        default:
    340                                 printf("Bad argument to erf: %s\n", opt);
     341                                printf("Bad argument to erf: %s\n", optarg);
    341342                                // maybe spit out some help here
    342343                                return -1;
     
    372373#endif
    373374        free(libtrace->format_data);
     375        return 0;
    374376}
    375377
    376378static int rtclient_fin_input(struct libtrace_t *libtrace) {
    377379        close(INPUT.fd);
     380        return 0;
    378381}
    379382
     
    385388#endif
    386389        free(libtrace->format_data);
     390
     391        return 0;
    387392}
    388393 
     
    455460        int numbytes;
    456461        int size;
    457         char buf[RP_BUFSIZE];
    458         dag_record_t *erfptr;
    459462        void *buffer = packet->buffer;
    460463        void *buffer2 = buffer;
     
    495498static int rtclient_read(struct libtrace_t *libtrace, void *buffer, size_t len) {
    496499        int numbytes;
    497         static short lctr = 0;
    498         struct dag_record_t *erfptr = 0;
    499         int rlen;
    500500
    501501        if (buffer == 0)
     
    527527        int size = 0;
    528528        char buf[RP_BUFSIZE];
    529         dag_record_t *erfptr = 0;
    530529        int read_required = 0;
    531530       
     
    719718}
    720719
    721 static int rtclient_get_fd(struct libtrace_packet_t *packet) {
     720static int rtclient_get_fd(const struct libtrace_packet_t *packet) {
    722721        return packet->trace->format_data->input.fd;
    723722}
    724723
    725 static int erf_get_fd(struct libtrace_packet_t *packet) {
     724static int erf_get_fd(const struct libtrace_packet_t *packet) {
    726725        return packet->trace->format_data->input.fd;
    727726}
  • lib/format_helper.c

    r39b37d2 r9c6aa95  
    3333#include "config.h"
    3434
     35#include <stdlib.h>
     36#include <stdio.h>
     37#include <string.h>
    3538#ifdef HAVE_INTTYPES_H
    3639#  include <inttypes.h>
     
    119122
    120123        if (!trace->event.packet.buffer) {
    121                 trace->event.packet.buffer = malloc(4096);
     124                trace->event.packet.buffer = (void *)malloc(4096);
    122125                trace->event.packet.size=
    123126                        trace_read_packet(trace,packet);
  • lib/format_pcap.c

    rb69afb1 r9c6aa95  
    4646#include <assert.h>
    4747#include <stdio.h>
     48#include <stdlib.h>
     49#include <string.h>
    4850
    4951#if HAVE_PCAP_BPF_H
     
    157159
    158160static int pcap_init_output(struct libtrace_out_t *libtrace) {
    159         char errbuf[PCAP_ERRBUF_SIZE];
    160         struct stat buf;
    161161        libtrace->format_data = (struct libtrace_format_data_out_t *)
    162162                malloc(sizeof(struct libtrace_format_data_out_t));
     
    185185}
    186186
    187 static int pcapint_init_output(struct libtrace_out_t *libtrace) {
     187static int pcapint_init_output(struct libtrace_out_t *libtrace __attribute__((unused))) {
    188188        return -1;
    189189}
     
    201201}
    202202
    203 static int pcapint_fin_output(struct libtrace_out_t *libtrace) {
     203static int pcapint_fin_output(struct libtrace_out_t *libtrace __attribute__((unused))) {
    204204        return -1;
    205205}
     
    218218
    219219static int pcap_read_packet(struct libtrace_t *libtrace, struct libtrace_packet_t *packet) {
    220         const u_char *pcappkt;
    221220        int pcapbytes = 0;
    222221
     
    260259}
    261260
    262 static int pcapint_write_packet(struct libtrace_out_t *libtrace, struct libtrace_packet_t *packet) {
    263         void *link = trace_get_link(packet);
    264 
     261static int pcapint_write_packet(struct libtrace_out_t *libtrace __attribute__((unused)), struct libtrace_packet_t *packet __attribute__((unused))) {
     262//      void *link = trace_get_link(packet);
     263
     264        return 0;
    265265}
    266266
     
    379379}
    380380
    381 static int pcap_get_fd(struct libtrace_packet_t *packet) {
     381static int pcap_get_fd(const struct libtrace_packet_t *packet) {
    382382        return pcap_fileno(packet->trace->format_data->input.pcap);
    383383}
  • lib/format_template.c

    r1974620 r9c6aa95  
    3333#include "format_helper.h"
    3434#include "config.h"
     35#include "stdlib.h"
    3536
    3637#ifdef HAVE_INTTYPES_H
     
    110111}
    111112
    112 static size_t template_set_capture_length(const struct libtrace_packet_t *packet,size_t size) {
     113static size_t template_set_capture_length(struct libtrace_packet_t *packet,size_t size) {
    113114        return -1;
    114115}
  • lib/format_wag.c

    rb69afb1 r9c6aa95  
    2929 */
    3030
     31#define _GNU_SOURCE
    3132#include "libtrace.h"
    3233#include "libtrace_int.h"
     
    5960#include <netdb.h>
    6061#include <stdio.h>
     62#include <string.h>
     63#include <stdlib.h>
    6164
    6265#ifdef HAVE_LIMITS_H
     
    120123static int wag_init_input(struct libtrace_t *libtrace) {
    121124        struct stat buf;
    122         struct hostent *he;
    123         struct sockaddr_in remote;
    124125        struct sockaddr_un unix_sock;
    125126        libtrace->format_data = (struct libtrace_format_data_t *)
     
    225226                                break;
    226227                        default:
    227                                 printf("Bad argument to wag: %s\n", opt);
     228                                printf("Bad argument to wag: %s\n", optarg);
    228229                                return -1;
    229230                }
     
    248249        fclose(INPUT.file);     
    249250#endif
     251        return 0;
    250252}
    251253
     
    256258        fclose(OUTPUT.file);
    257259#endif
     260        return 0;
    258261}
    259262
    260263static int wag_read(struct libtrace_t *libtrace, void *buffer, size_t len) {
    261264        int numbytes;
    262         static short lctr = 0;
    263         int rlen;
    264265        assert(libtrace);
    265         assert(len >= 0);
    266266
    267267        if (buffer == 0)
     
    312312        char buf[RP_BUFSIZE];
    313313        int read_required = 0;
    314         struct wag_frame_hdr *waghdr = 0;
    315314
    316315        void *buffer = 0;
     
    389388}
    390389
    391 static libtrace_linktype_t wag_get_link_type(const struct libtrace_packet_t *packet) {
     390static libtrace_linktype_t wag_get_link_type(const struct libtrace_packet_t *packet __attribute__((unused))) {
    392391        return TRACE_TYPE_80211;
    393392}
     
    435434        }
    436435}
    437 static int wag_help() {
     436static void wag_help() {
    438437        printf("wag format module: $Revision$\n");
    439438        printf("Supported input URIs:\n");
     
    448447        printf("\tnone\n");
    449448        printf("\n");
    450 
    451449}
    452450
  • lib/libtrace_int.h

    rae8196e r9c6aa95  
    165165        int (*get_wire_length)(const struct libtrace_packet_t *packet);
    166166        size_t (*truncate_packet)(struct libtrace_packet_t *packet,size_t size);
    167         int (*get_fd)(struct libtrace_packet_t *packet);
     167        int (*get_fd)(const struct libtrace_packet_t *packet);
    168168        struct libtrace_eventobj_t (*trace_event)(struct libtrace_t *trace, struct libtrace_packet_t *packet); 
    169169        void (*help)();
  • lib/pcap_dump_flush.c

    r5c88a60 r9c6aa95  
    77# include <pcap-int.h>
    88#else
    9 # error "Need pcap-int.h for declaration of pcap_t"
     9//# error "Need pcap-int.h for declaration of pcap_t"
    1010#endif
    1111#include <string.h>
  • lib/trace.c

    rdf6ae1f r9c6aa95  
    241241        char *uridata = 0;                 
    242242        int i = 0;
    243         struct stat buf;
     243        //struct stat buf;
    244244       
    245245        trace_err.err_num = E_NOERROR;
     
    433433        parse_cmd(opt_string, &opt_argc, opt_argv, MAXOPTS);
    434434       
    435         if (libtrace->format->config_output)
     435        if (libtrace->format->config_output) {
    436436                return libtrace->format->config_output(libtrace, opt_argc, opt_argv);
    437 
     437        }
     438        return -1;
    438439}
    439440
     
    491492                return libtrace->format->read_packet(libtrace,packet);
    492493        }
     494        return -1;
    493495}
    494496
     
    508510                return libtrace->format->write_packet(libtrace, packet);
    509511        }
    510 
     512        return -1;
    511513}
    512514
     
    555557                                        if (eth->type == 0x0008) {
    556558                                                ipptr=(void*)eth->data;
    557                                         } else if (eth->type = 0x0081) {
     559                                        } else if (eth->type == 0x0081) {
    558560                                                // VLAN
    559561                                                if ((*(uint16_t *)(eth + 16)) == 0x0008) {
     
    892894 */
    893895double trace_get_seconds(const struct libtrace_packet_t *packet) {
    894         double seconds;
    895         uint64_t ts;
     896        double seconds = 0.0;
     897        uint64_t ts = 0;
    896898        struct timeval tv;
    897899       
     
    12061208 * @author Daniel Lawson
    12071209 */
    1208 int8_t trace_get_server_port(uint8_t protocol, uint16_t source, uint16_t dest) {
     1210int8_t trace_get_server_port(uint8_t protocol __attribute__((unused)), uint16_t source, uint16_t dest) {
    12091211        /*
    12101212         * * If the ports are equal, return DEST
     
    12181220         * * flip a coin.
    12191221         */
    1220 
    1221         uint16_t server, client;
    1222 
     1222       
    12231223        /* equal */
    1224         if (source == client)
     1224        if (source == dest)
    12251225                return USE_DEST;
    12261226
Note: See TracChangeset for help on using the changeset viewer.