Committer:
jp
Date:
Sun Feb 13 02:18:50 2011 +0000
Revision:
3:d0fc1ce5e516
Parent:
2:98b11b7dd7b2

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jp 0:cf255d2aa92f 1 /*
jp 2:98b11b7dd7b2 2 * Copyright or � or Copr. 2010, Thomas SOETE
jp 0:cf255d2aa92f 3 *
jp 0:cf255d2aa92f 4 * Author e-mail: thomas@soete.org
jp 0:cf255d2aa92f 5 * Library website : http://mbed.org/users/Alkorin/libraries/SimpleLib/
jp 0:cf255d2aa92f 6 *
jp 0:cf255d2aa92f 7 * This software is governed by the CeCILL license under French law and
jp 0:cf255d2aa92f 8 * abiding by the rules of distribution of free software. You can use,
jp 0:cf255d2aa92f 9 * modify and/ or redistribute the software under the terms of the CeCILL
jp 0:cf255d2aa92f 10 * license as circulated by CEA, CNRS and INRIA at the following URL
jp 0:cf255d2aa92f 11 * "http://www.cecill.info".
jp 0:cf255d2aa92f 12 *
jp 0:cf255d2aa92f 13 * As a counterpart to the access to the source code and rights to copy,
jp 0:cf255d2aa92f 14 * modify and redistribute granted by the license, users are provided only
jp 0:cf255d2aa92f 15 * with a limited warranty and the software's author, the holder of the
jp 0:cf255d2aa92f 16 * economic rights, and the successive licensors have only limited
jp 0:cf255d2aa92f 17 * liability.
jp 0:cf255d2aa92f 18 *
jp 0:cf255d2aa92f 19 * In this respect, the user's attention is drawn to the risks associated
jp 0:cf255d2aa92f 20 * with loading, using, modifying and/or developing or reproducing the
jp 0:cf255d2aa92f 21 * software by the user in light of its specific status of free software,
jp 0:cf255d2aa92f 22 * that may mean that it is complicated to manipulate, and that also
jp 0:cf255d2aa92f 23 * therefore means that it is reserved for developers and experienced
jp 0:cf255d2aa92f 24 * professionals having in-depth computer knowledge. Users are therefore
jp 0:cf255d2aa92f 25 * encouraged to load and test the software's suitability as regards their
jp 0:cf255d2aa92f 26 * requirements in conditions enabling the security of their systems and/or
jp 0:cf255d2aa92f 27 * data to be ensured and, more generally, to use and operate it in the
jp 0:cf255d2aa92f 28 * same conditions as regards security.
jp 0:cf255d2aa92f 29 *
jp 0:cf255d2aa92f 30 * The fact that you are presently reading this means that you have had
jp 0:cf255d2aa92f 31 * knowledge of the CeCILL license and that you accept its terms.
jp 0:cf255d2aa92f 32 */
jp 0:cf255d2aa92f 33
jp 0:cf255d2aa92f 34 #ifndef __SIMPLELIB_ETHERNET_H__
jp 0:cf255d2aa92f 35 #define __SIMPLELIB_ETHERNET_H__
jp 0:cf255d2aa92f 36
jp 0:cf255d2aa92f 37 typedef __packed struct {
jp 0:cf255d2aa92f 38 char destination[6];
jp 0:cf255d2aa92f 39 char source[6];
jp 0:cf255d2aa92f 40 uint16_t type;
jp 0:cf255d2aa92f 41 } ethernet_packet;
jp 0:cf255d2aa92f 42 #define asETH(x) ((ethernet_packet*)(x))
jp 0:cf255d2aa92f 43
jp 0:cf255d2aa92f 44 #define IPV4_TYPE 0x0800
jp 0:cf255d2aa92f 45 #define ARP_TYPE 0x0806
jp 0:cf255d2aa92f 46
jp 0:cf255d2aa92f 47 typedef __packed struct {
jp 0:cf255d2aa92f 48 ethernet_packet eth;
jp 0:cf255d2aa92f 49 __packed struct {
jp 0:cf255d2aa92f 50 char hardware_type[2];
jp 0:cf255d2aa92f 51 char protocol_type[2];
jp 0:cf255d2aa92f 52 char hardware_size;
jp 0:cf255d2aa92f 53 char protocol_size;
jp 0:cf255d2aa92f 54 uint16_t opcode_request;
jp 0:cf255d2aa92f 55 char sender_mac[6];
jp 0:cf255d2aa92f 56 char sender_ip[4];
jp 0:cf255d2aa92f 57 char target_mac[6];
jp 0:cf255d2aa92f 58 char target_ip[4];
jp 0:cf255d2aa92f 59 } arp;
jp 0:cf255d2aa92f 60 } arp_packet;
jp 0:cf255d2aa92f 61 #define asARP(x) ((arp_packet*)(x))
jp 0:cf255d2aa92f 62
jp 0:cf255d2aa92f 63 #define ARP_REQUEST 0x0001
jp 0:cf255d2aa92f 64 #define ARP_REPLY 0x0002
jp 0:cf255d2aa92f 65
jp 0:cf255d2aa92f 66 #endif