Sha256: e8f5bed7a5ce8470b2a9fa0d1176718f4617a0c22758da1321ba697d13769a70

Contents?: true

Size: 1.39 KB

Versions: 13

Compression:

Stored size: 1.39 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 %zu octets padding ( original frame length = %zu ).",
           buf->length, padding_length );
    void *padding = append_back_buffer( buf, padding_length );
    memset( padding, 0, padding_length );
  }
  return ( uint16_t ) padding_length;
}


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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
trema-0.3.9 src/lib/ether.c
trema-0.3.8 src/lib/ether.c
trema-0.3.7 src/lib/ether.c
trema-0.3.6 src/lib/ether.c
trema-0.3.5 src/lib/ether.c
trema-0.3.4 src/lib/ether.c
trema-0.3.3 src/lib/ether.c
trema-0.3.2 src/lib/ether.c
trema-0.3.1 src/lib/ether.c
trema-0.3.0 src/lib/ether.c
trema-0.2.8 src/lib/ether.c
trema-0.2.7 src/lib/ether.c
trema-0.2.6 src/lib/ether.c