Ignore:
Timestamp:
02/09/10 13:43:51 (12 years ago)
Author:
Shane Alcock <salcock@…>
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:
ebf8071
Parents:
22a9ccc
Message:
  • Updated licensing and documentation for the protocol decoders
  • Moved trace_get_source_mac and trace_get_destination_mac into protocols_l2.c which is much more appropriate
  • Re-wrote trace_get_destination_mac to match the behaviour of trace_get_source_mac, especially with regard to ignoring link types that match meta-data headers
  • Added TRACE_TYPE_NONDATA handlers to several switch statements
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/protocols_transport.c

    r9dc77f3 rf6730d8  
     1/*
     2 * This file is part of libtrace
     3 *
     4 * Copyright (c) 2007,2008,2009,2010 The University of Waikato, Hamilton,
     5 * New Zealand.
     6 *
     7 * Authors: Daniel Lawson
     8 *          Perry Lorier
     9 *          Shane Alcock
     10 *         
     11 * All rights reserved.
     12 *
     13 * This code has been developed by the University of Waikato WAND
     14 * research group. For further information please see http://www.wand.net.nz/
     15 *
     16 * libtrace is free software; you can redistribute it and/or modify
     17 * it under the terms of the GNU General Public License as published by
     18 * the Free Software Foundation; either version 2 of the License, or
     19 * (at your option) any later version.
     20 *
     21 * libtrace is distributed in the hope that it will be useful,
     22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     24 * GNU General Public License for more details.
     25 *
     26 * You should have received a copy of the GNU General Public License
     27 * along with libtrace; if not, write to the Free Software
     28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     29 *
     30 * $Id$
     31 *
     32 */
     33
     34
    135#include "libtrace.h"
    236#include "protocols.h"
     
    438#include <stdlib.h>
    539#include <stdio.h> // fprintf
     40
     41/* This file contains all the protocol decoding functions for transport layer
     42 * protocols. This includes functions for access port numbers.
     43 *
     44 * Supported protocols include (but are not limited to):
     45 *      TCP
     46 *      UDP
     47 *      ICMP
     48 */
    649
    750DLLEXPORT void *trace_get_transport(const libtrace_packet_t *packet,
     
    179222}
    180223
    181 /* Return the client port
     224/* Return the source port
    182225 */
    183226DLLEXPORT uint16_t trace_get_source_port(const libtrace_packet_t *packet)
     
    189232                        &proto, &remaining);
    190233
    191         /* snapped too early */
     234        /* Snapped too early */
    192235        if (remaining<2)
    193236                return 0;
     
    211254                (struct ports_t*)trace_get_transport((libtrace_packet_t*)packet,
    212255                        &proto, &remaining);
    213         /* snapped to early */
     256        /* Snapped too early */
    214257        if (remaining<4)
    215258                return 0;
Note: See TracChangeset for help on using the changeset viewer.