Changeset e6d963c


Ignore:
Timestamp:
05/02/06 00:08:58 (15 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:
e093e5c
Parents:
ddd01fb
Message:

Style fixes, get rid of unnecessary "struct"'s

Location:
lib
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • lib/format_erf.c

    r747c501 re6d963c  
    144144
    145145#ifdef HAVE_DAG
    146 static int dag_init_input(struct libtrace_t *libtrace) {
     146static int dag_init_input(libtrace_t *libtrace) {
    147147        struct stat buf;
    148148
     
    687687        }
    688688
    689         if ((numbytes=libtrace_io_write(OUTPUT.file, buffer, size)) != size) {
     689        if ((numbytes=libtrace_io_write(OUTPUT.file, buffer, size)) != (int)size) {
    690690                trace_set_err_out(libtrace,errno,
    691691                                "write(%s)",libtrace->uridata);
  • lib/format_legacy.c

    r088533a re6d963c  
    7575};
    7676
    77 static int legacyeth_get_framing_length(const struct libtrace_packet_t *packet UNUSED)
     77static int legacyeth_get_framing_length(const libtrace_packet_t *packet UNUSED)
    7878{
    7979        return sizeof(legacy_ether_t);
    8080}
    8181
    82 static int legacypos_get_framing_length(const struct libtrace_packet_t *packet UNUSED)
     82static int legacypos_get_framing_length(const libtrace_packet_t *packet UNUSED)
    8383{
    8484        return sizeof(legacy_pos_t);
    8585}
    8686
    87 static int legacyatm_get_framing_length(const struct libtrace_packet_t *packet UNUSED)
     87static int legacyatm_get_framing_length(const libtrace_packet_t *packet UNUSED)
    8888{
    8989        return sizeof(legacy_cell_t);
    9090}
    9191
    92 static int erf_init_input(struct libtrace_t *libtrace)
     92static int erf_init_input(libtrace_t *libtrace)
    9393{
    9494        libtrace->format_data = malloc(sizeof(struct legacy_format_data_t));
     
    107107}
    108108
    109 static int erf_fin_input(struct libtrace_t *libtrace) {
     109static int erf_fin_input(libtrace_t *libtrace) {
    110110        libtrace_io_close(INPUT.file);
    111111        free(libtrace->format_data);
     
    113113}
    114114
    115 static int legacy_read_packet(struct libtrace_t *libtrace, struct libtrace_packet_t *packet) {
     115static int legacy_read_packet(libtrace_t *libtrace, libtrace_packet_t *packet) {
    116116        int numbytes;
    117117        void *buffer;
     
    152152}
    153153
    154 static libtrace_linktype_t legacypos_get_link_type(const struct libtrace_packet_t *packet UNUSED) {
     154static libtrace_linktype_t legacypos_get_link_type(const libtrace_packet_t *packet UNUSED) {
    155155        return TRACE_TYPE_POS;
    156156}
    157157
    158 static libtrace_linktype_t legacyatm_get_link_type(const struct libtrace_packet_t *packet UNUSED) {
     158static libtrace_linktype_t legacyatm_get_link_type(const libtrace_packet_t *packet UNUSED) {
    159159        return TRACE_TYPE_ATM;
    160160}
    161161
    162 static libtrace_linktype_t legacyeth_get_link_type(const struct libtrace_packet_t *packet UNUSED) {
     162static libtrace_linktype_t legacyeth_get_link_type(const libtrace_packet_t *packet UNUSED) {
    163163        return TRACE_TYPE_ETH;
    164164}
    165165
    166 static int legacy_get_capture_length(const struct libtrace_packet_t *packet UNUSED) {
     166static int legacy_get_capture_length(const libtrace_packet_t *packet UNUSED) {
    167167        return 64;
    168168}
    169169
    170 static int legacypos_get_wire_length(const struct libtrace_packet_t *packet) {
     170static int legacypos_get_wire_length(const libtrace_packet_t *packet) {
    171171        legacy_pos_t *lpos = (legacy_pos_t *)packet->header;
    172172        return ntohs(lpos->wlen);
    173173}
    174174
    175 static int legacyatm_get_wire_length(const struct libtrace_packet_t *packet UNUSED) {
     175static int legacyatm_get_wire_length(const libtrace_packet_t *packet UNUSED) {
    176176        return 53;
    177177}
    178178
    179 static int legacyeth_get_wire_length(const struct libtrace_packet_t *packet) {
     179static int legacyeth_get_wire_length(const libtrace_packet_t *packet) {
    180180        legacy_ether_t *leth = (legacy_ether_t *)packet->header;
    181181        return ntohs(leth->wlen);
    182182}
    183183
    184 static uint64_t legacy_get_erf_timestamp(const struct libtrace_packet_t *packet)
     184static uint64_t legacy_get_erf_timestamp(const libtrace_packet_t *packet)
    185185{
    186186        legacy_ether_t *legacy = (legacy_ether_t*)packet->header;
  • lib/format_pcap.c

    r9d7d9e9 re6d963c  
    8686};
    8787
    88 static int pcap_init_input(struct libtrace_t *libtrace) {
     88static int pcap_init_input(libtrace_t *libtrace) {
    8989        libtrace->format_data = malloc(sizeof(struct pcap_format_data_t));
    9090
     
    9797}
    9898
    99 static int pcap_start_input(struct libtrace_t *libtrace) {
     99static int pcap_start_input(libtrace_t *libtrace) {
    100100        char errbuf[PCAP_ERRBUF_SIZE];
    101101
     
    173173}
    174174
    175 static int pcapint_init_input(struct libtrace_t *libtrace) {
     175static int pcapint_init_input(libtrace_t *libtrace) {
    176176        libtrace->format_data = malloc(sizeof(struct pcap_format_data_t));
    177177        DATA(libtrace)->filter = NULL;
     
    261261
    262262static void trace_pcap_handler(u_char *user, const struct pcap_pkthdr *pcaphdr, const u_char *pcappkt) {
    263         struct libtrace_packet_t *packet = (struct libtrace_packet_t *)user;   
     263        libtrace_packet_t *packet = (libtrace_packet_t *)user; 
    264264        /*
    265265        // pcap provides us with the right bits, in it's own buffers.
     
    284284
    285285/* TODO: use pcap_next_ex() if available */
    286 static int pcap_read_packet(struct libtrace_t *libtrace, struct libtrace_packet_t *packet) {
     286static int pcap_read_packet(libtrace_t *libtrace, libtrace_packet_t *packet) {
    287287        int pcapbytes = 0;
    288288        int linktype;
     
    435435
    436436
    437 static struct timeval pcap_get_timeval(const struct libtrace_packet_t *packet) {
     437static struct timeval pcap_get_timeval(const libtrace_packet_t *packet) {
    438438        struct pcap_pkthdr *pcapptr = (struct pcap_pkthdr *)packet->header;
    439439        struct timeval ts;
  • lib/format_pcapfile.c

    r030aa3f re6d963c  
    5757};
    5858
    59 static int pcapfile_init_input(struct libtrace_t *libtrace) {
     59static int pcapfile_init_input(libtrace_t *libtrace) {
    6060        libtrace->format_data = malloc(sizeof(struct pcapfile_format_data_t));
    6161
     
    154154};
    155155
    156 static int pcapfile_read_packet(struct libtrace_t *libtrace, struct libtrace_packet_t *packet) {
     156static int pcapfile_read_packet(libtrace_t *libtrace, libtrace_packet_t *packet) {
    157157        int err;
    158158
     
    277277
    278278static struct timeval pcapfile_get_timeval(
    279                 const struct libtrace_packet_t *packet)
     279                const libtrace_packet_t *packet)
    280280{
    281281        struct pcapfile_pkt_hdr_t *hdr =
  • lib/format_rt.c

    rc4a4d3d re6d963c  
    8585
    8686       
    87         struct libtrace_t *dummy_erf;
    88         struct libtrace_t *dummy_pcap;
    89         struct libtrace_t *dummy_wag;
     87        libtrace_t *dummy_erf;
     88        libtrace_t *dummy_pcap;
     89        libtrace_t *dummy_wag;
    9090};
    9191
    9292static struct libtrace_format_t rt;
    9393
    94 static int rt_connect(struct libtrace_t *libtrace) {
     94static int rt_connect(libtrace_t *libtrace) {
    9595        struct hostent *he;
    9696        struct sockaddr_in remote;
     
    187187
    188188
    189 static int rt_init_input(struct libtrace_t *libtrace) {
     189static int rt_init_input(libtrace_t *libtrace) {
    190190        char *scan;
    191191        char *uridata = libtrace->uridata;
     
    222222}
    223223       
    224 static int rt_start_input(struct libtrace_t *libtrace) {
     224static int rt_start_input(libtrace_t *libtrace) {
    225225        rt_header_t start_msg;
    226226
     
    239239}
    240240
    241 static int rt_fin_input(struct libtrace_t *libtrace) {
     241static int rt_fin_input(libtrace_t *libtrace) {
    242242        rt_header_t close_msg;
    243243
     
    267267#define RT_BUF_SIZE 4000
    268268
    269 static int rt_read(struct libtrace_t *libtrace, void **buffer, size_t len, int block) {
     269static int rt_read(libtrace_t *libtrace, void **buffer, size_t len, int block) {
    270270        int numbytes;
    271271        rt_header_t *test_hdr;
     
    386386}               
    387387
    388 static void rt_set_payload(struct libtrace_packet_t *packet) {
     388static void rt_set_payload(libtrace_packet_t *packet) {
    389389        dag_record_t *erfptr;
    390390       
     
    405405}
    406406
    407 static int rt_send_ack(struct libtrace_t *libtrace,
     407static int rt_send_ack(libtrace_t *libtrace,
    408408                uint32_t seqno)  {
    409409       
     
    537537
    538538
    539 static int rt_get_capture_length(const struct libtrace_packet_t *packet) {
     539static int rt_get_capture_length(const libtrace_packet_t *packet) {
    540540        switch (packet->type) {
    541541                case RT_DUCK:
     
    580580}
    581581
    582 struct libtrace_eventobj_t trace_event_rt(struct libtrace_t *trace, struct libtrace_packet_t *packet) {
    583         struct libtrace_eventobj_t event = {0,0,0.0,0};
     582libtrace_eventobj_t trace_event_rt(libtrace_t *trace, libtrace_packet_t *packet) {
     583        libtrace_eventobj_t event = {0,0,0.0,0};
    584584        libtrace_err_t read_err;
    585585
  • lib/format_wag.c

    r0210df3 re6d963c  
    114114}
    115115
    116 static int wtf_init_input(struct libtrace_t *libtrace)
     116static int wtf_init_input(libtrace_t *libtrace)
    117117{
    118118        libtrace->format_data = calloc(1,sizeof(struct wag_format_data_t));
     
    132132}
    133133
    134 static int wtf_init_output(struct libtrace_out_t *libtrace) {
     134static int wtf_init_output(libtrace_out_t *libtrace) {
    135135        libtrace->format_data = malloc(sizeof(struct wag_format_data_out_t));
    136136
     
    152152}
    153153
    154 static int wtf_config_output(struct libtrace_out_t *libtrace,
     154static int wtf_config_output(libtrace_out_t *libtrace,
    155155                trace_option_output_t option,
    156156                void *value) {
     
    183183}
    184184
    185 static int wag_fin_input(struct libtrace_t *libtrace) {
     185static int wag_fin_input(libtrace_t *libtrace) {
    186186        free(libtrace->format_data);
    187187        return 0;
    188188}
    189189
    190 static int wtf_fin_input(struct libtrace_t *libtrace) {
     190static int wtf_fin_input(libtrace_t *libtrace) {
    191191        libtrace_io_close(INPUT.file);
    192192        free(libtrace->format_data);
     
    194194}
    195195
    196 static int wtf_fin_output(struct libtrace_out_t *libtrace) {
     196static int wtf_fin_output(libtrace_out_t *libtrace) {
    197197        libtrace_io_close(OUTPUT.file);
    198198        free(libtrace->format_data);
     
    200200}
    201201
    202 static int wag_read(struct libtrace_t *libtrace, void *buffer, size_t len) {
     202static int wag_read(libtrace_t *libtrace, void *buffer, size_t len) {
    203203        size_t framesize;
    204204        char *buf_ptr = (char *)buffer;
     
    260260
    261261
    262 static int wag_read_packet(struct libtrace_t *libtrace, struct libtrace_packet_t *packet) {
     262static int wag_read_packet(libtrace_t *libtrace, libtrace_packet_t *packet) {
    263263        int numbytes;
    264264       
     
    283283}
    284284
    285 static int wtf_read_packet(struct libtrace_t *libtrace, struct libtrace_packet_t *packet) {
     285static int wtf_read_packet(libtrace_t *libtrace, libtrace_packet_t *packet) {
    286286        int numbytes;
    287287        void *buffer;
     
    335335}                               
    336336       
    337 static int wtf_write_packet(struct libtrace_out_t *libtrace, const struct libtrace_packet_t *packet) {
     337static int wtf_write_packet(libtrace_out_t *libtrace, const libtrace_packet_t *packet) {
    338338        int numbytes =0 ;
    339339        if (packet->trace->format != &wag_trace) {
     
    362362}
    363363
    364 static libtrace_linktype_t wag_get_link_type(const struct libtrace_packet_t *packet UNUSED) {
     364static libtrace_linktype_t wag_get_link_type(const libtrace_packet_t *packet UNUSED) {
    365365        return TRACE_TYPE_80211;
    366366}
    367367
    368 static int8_t wag_get_direction(const struct libtrace_packet_t *packet) {
     368static int8_t wag_get_direction(const libtrace_packet_t *packet) {
    369369        struct frame_data_rx_t *wagptr = (struct frame_data_rx_t *)packet->buffer;
    370370        if (wagptr->hdr.type == 0) {
     
    374374}
    375375
    376 static uint64_t wag_get_erf_timestamp(const struct libtrace_packet_t *packet) {
     376static uint64_t wag_get_erf_timestamp(const libtrace_packet_t *packet) {
    377377        struct frame_data_rx_t *wagptr = (struct frame_data_rx_t *)packet->buffer;
    378378        uint64_t timestamp = 0;
     
    381381}
    382382
    383 static int wag_get_capture_length(const struct libtrace_packet_t *packet) {
     383static int wag_get_capture_length(const libtrace_packet_t *packet) {
    384384        return ntohs(((struct frame_t *)packet->header)->size)
    385385                -sizeof(struct frame_data_rx_t);
    386386}
    387387
    388 static int wag_get_wire_length(const struct libtrace_packet_t *packet) {
     388static int wag_get_wire_length(const libtrace_packet_t *packet) {
    389389        return ntohs(((struct frame_t *)packet->header)->size)
    390390                -sizeof(struct frame_data_rx_t);
  • lib/protocols.c

    rc05dda6 re6d963c  
    379379DLLEXPORT libtrace_tcp_t *trace_get_tcp_from_ip(libtrace_ip_t *ip, uint32_t *remaining)
    380380{
    381         struct libtrace_tcp *tcpptr = 0;
     381        libtrace_tcp_t *tcpptr = 0;
    382382
    383383        if (ip->ip_p == 6)  {
    384                 tcpptr = (struct libtrace_tcp *)
     384                tcpptr = (libtrace_tcp_t *)
    385385                        trace_get_payload_from_ip(ip, NULL, remaining);
    386386        }
     
    403403DLLEXPORT libtrace_udp_t *trace_get_udp_from_ip(libtrace_ip_t *ip, uint32_t *remaining)
    404404{
    405         struct libtrace_udp *udpptr = 0;
     405        libtrace_udp_t *udpptr = 0;
    406406
    407407        if (ip->ip_p == 17) {
  • lib/trace.c

    r4927e86 re6d963c  
    258258 */
    259259DLLEXPORT SIMPLE_FUNCTION
    260 char *trace_get_output_format(const struct libtrace_out_t *libtrace) {
     260char *trace_get_output_format(const libtrace_out_t *libtrace) {
    261261        char * format = libtrace->format->name;
    262262
     
    289289 * and an error is output to stdout.
    290290 */
    291 DLLEXPORT struct libtrace_t *trace_create(const char *uri) {
    292         struct libtrace_t *libtrace =
    293                         (struct libtrace_t *)malloc(sizeof(struct libtrace_t));
     291DLLEXPORT libtrace_t *trace_create(const char *uri) {
     292        libtrace_t *libtrace =
     293                        (libtrace_t *)malloc(sizeof(libtrace_t));
    294294        char *scan = 0;
    295295        const char *uridata = 0;                 
     
    370370 * libtrace_packet_t's that are not associated with a libtrace_t structure.
    371371 */
    372 DLLEXPORT struct libtrace_t * trace_create_dead (const char *uri) {
    373         struct libtrace_t *libtrace = (struct libtrace_t *)
    374                                         malloc(sizeof(struct libtrace_t));
     372DLLEXPORT libtrace_t * trace_create_dead (const char *uri) {
     373        libtrace_t *libtrace = (libtrace_t *) malloc(sizeof(libtrace_t));
    375374        char *scan = (char *)calloc(sizeof(char),URI_PROTO_LINE);
    376375        char *uridata;
     
    419418DLLEXPORT libtrace_out_t *trace_create_output(const char *uri) {
    420419        libtrace_out_t *libtrace =
    421                         (libtrace_out_t*)malloc(sizeof(struct libtrace_out_t));
     420                        (libtrace_out_t*)malloc(sizeof(libtrace_out_t));
    422421       
    423422        char *scan = 0;
     
    490489 * the trace.  it may fail.
    491490 */
    492 DLLEXPORT int trace_start(struct libtrace_t *libtrace)
     491DLLEXPORT int trace_start(libtrace_t *libtrace)
    493492{
    494493        assert(libtrace);
     
    543542                        return 0;
    544543                case TRACE_OPTION_FILTER:
    545                         libtrace->filter=(struct libtrace_filter_t *)value;
     544                        libtrace->filter=(libtrace_filter_t *)value;
    546545                        return 0;
    547546                case TRACE_OPTION_PROMISC:
     
    563562 * @author Shane Alcock
    564563 */
    565 DLLEXPORT int trace_config_output(struct libtrace_out_t *libtrace,
     564DLLEXPORT int trace_config_output(libtrace_out_t *libtrace,
    566565                trace_option_output_t option,
    567566                void *value) {
     
    575574 *
    576575 */
    577 DLLEXPORT void trace_destroy(struct libtrace_t *libtrace) {
     576DLLEXPORT void trace_destroy(libtrace_t *libtrace) {
    578577        assert(libtrace);
    579578        if (libtrace->started && libtrace->format->pause_input)
     
    587586
    588587
    589 DLLEXPORT void trace_destroy_dead(struct libtrace_t *libtrace) {
     588DLLEXPORT void trace_destroy_dead(libtrace_t *libtrace) {
    590589        assert(libtrace);
    591590        free(libtrace);
     
    597596 * @author Shane Alcock
    598597 * */
    599 DLLEXPORT void trace_destroy_output(struct libtrace_out_t *libtrace) {
     598DLLEXPORT void trace_destroy_output(libtrace_out_t *libtrace) {
    600599        assert(libtrace);
    601600        libtrace->format->fin_output(libtrace);
     
    634633 * sideeffect: sets packet to NULL
    635634 */
    636 DLLEXPORT void trace_destroy_packet(struct libtrace_packet_t **packet) {
     635DLLEXPORT void trace_destroy_packet(libtrace_packet_t **packet) {
    637636        if ((*packet)->buf_control == TRACE_CTRL_PACKET) {
    638637                free((*packet)->buffer);
     
    696695 * @author Shane Alcock
    697696 * */
    698 DLLEXPORT int trace_write_packet(struct libtrace_out_t *libtrace, const struct libtrace_packet_t *packet) {
     697DLLEXPORT int trace_write_packet(libtrace_out_t *libtrace, const libtrace_packet_t *packet) {
    699698        assert(libtrace);
    700699        assert(packet);
     
    710709}
    711710
    712 DLLEXPORT void *trace_get_link(const struct libtrace_packet_t *packet) {
     711DLLEXPORT void *trace_get_link(const libtrace_packet_t *packet) {
    713712        return (void *)packet->payload;
    714713}
     
    799798 * @author Perry Lorier
    800799 */
    801 DLLEXPORT double trace_get_seconds(const struct libtrace_packet_t *packet) {
     800DLLEXPORT double trace_get_seconds(const libtrace_packet_t *packet) {
    802801        double seconds = 0.0;
    803802        uint64_t ts = 0;
     
    893892 * @author Perry Lorier
    894893 */
    895 DLLEXPORT struct libtrace_eventobj_t trace_event(struct libtrace_t *trace,
    896                 struct libtrace_packet_t *packet) {
    897         struct libtrace_eventobj_t event = {TRACE_EVENT_IOWAIT,0,0.0,0};
     894DLLEXPORT libtrace_eventobj_t trace_event(libtrace_t *trace,
     895                libtrace_packet_t *packet) {
     896        libtrace_eventobj_t event = {TRACE_EVENT_IOWAIT,0,0.0,0};
    898897
    899898        if (!trace) {
     
    920919 * @author Daniel Lawson
    921920 */
    922 DLLEXPORT struct libtrace_filter_t *trace_bpf_setfilter(const char *filterstring) {
     921DLLEXPORT libtrace_filter_t *trace_bpf_setfilter(const char *filterstring) {
    923922#if HAVE_BPF
    924         libtrace_filter_t *filter = (struct libtrace_filter_t*)
    925                                 malloc(sizeof(struct libtrace_filter_t));
     923        libtrace_filter_t *filter = (libtrace_filter_t*)
     924                                malloc(sizeof(libtrace_filter_t));
    926925        filter->filterstring = strdup(filterstring);
    927926        filter->flag = 0;
     
    1000999}
    10011000
    1002 DLLEXPORT int trace_bpf_filter(struct libtrace_filter_t *filter,
    1003                         const struct libtrace_packet_t *packet) {
     1001DLLEXPORT int trace_bpf_filter(libtrace_filter_t *filter,
     1002                        const libtrace_packet_t *packet) {
    10041003#if HAVE_BPF
    10051004        void *linkptr = 0;
     
    10341033 * @author Daniel Lawson
    10351034 */
    1036 DLLEXPORT int8_t trace_set_direction(struct libtrace_packet_t *packet, int8_t direction) {
     1035DLLEXPORT int8_t trace_set_direction(libtrace_packet_t *packet, int8_t direction) {
    10371036        assert(packet);
    10381037        assert(packet->size>0 && packet->size<65536);
     
    10521051 * @author Daniel Lawson
    10531052 */
    1054 DLLEXPORT int8_t trace_get_direction(const struct libtrace_packet_t *packet) {
     1053DLLEXPORT int8_t trace_get_direction(const libtrace_packet_t *packet) {
    10551054        assert(packet);
    10561055        assert(packet->size>0 && packet->size<65536);
     
    11861185 * @author Daniel Lawson
    11871186 */
    1188 DLLEXPORT size_t trace_set_capture_length(struct libtrace_packet_t *packet, size_t size) {
     1187DLLEXPORT size_t trace_set_capture_length(libtrace_packet_t *packet, size_t size) {
    11891188        assert(packet);
    11901189        assert(packet->size>0 && packet->size<65536);
     
    12221221}
    12231222
    1224 enum base_format_t trace_get_format(struct libtrace_packet_t *packet)
     1223enum base_format_t trace_get_format(libtrace_packet_t *packet)
    12251224{
    12261225        assert(packet);
Note: See TracChangeset for help on using the changeset viewer.