Sha256: 19e5c3b9ffdaf188a20690b48c9abefe5a1077fcc029cdde0676ac2abe1b7b09

Contents?: true

Size: 1.33 KB

Versions: 7

Compression:

Stored size: 1.33 KB

Contents

/*
 * Author: Kazuya Suzuki
 *
 * Copyright (C) 2008-2012 NEC Corporation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License, version 2, as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */


#include <assert.h>
#include "checks.h"
#include "log.h"
#include "packet_info.h"
#include "wrapper.h"


uint16_t
fill_ether_padding( buffer *buf ) {
  die_if_NULL( buf );
  size_t padding_length = 0;

  if ( buf->length + ETH_FCS_LENGTH < ETH_MINIMUM_LENGTH ) {
    padding_length = ETH_MINIMUM_LENGTH - buf->length - ETH_FCS_LENGTH;
    debug( "Adding %u octets padding ( original frame length = %u ).", 
           buf->length, padding_length );
    append_back_buffer( buf, padding_length );
  }
  return ( uint16_t ) padding_length;
}


/*
 * Local variables:
 * c-basic-offset: 2
 * indent-tabs-mode: nil
 * End:
 */

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
trema-0.2.2.1 src/lib/ether.c
trema-0.2.2 src/lib/ether.c
trema-0.2.1 src/lib/ether.c
trema-0.2.0 src/lib/ether.c
trema-0.1.3.2 src/lib/ether.c
trema-0.1.3.1 src/lib/ether.c
trema-0.1.3 src/lib/ether.c