1 /****************************************************************************** 2 * Copyright (c) 2004, 2008 IBM Corporation 3 * All rights reserved. 4 * This program and the accompanying materials 5 * are made available under the terms of the BSD License 6 * which accompanies this distribution, and is available at 7 * http://www.opensource.org/licenses/bsd-license.php 8 * 9 * Contributors: 10 * IBM Corporation - initial implementation 11 *****************************************************************************/ 12 13 14 #ifndef _SOCKET_H 15 #define _SOCKET_H 16 #include <stdint.h> 17 18 #define AF_PACKET 0 19 #define AF_INET 1 20 #define AF_INET6 2 21 22 #define SOCK_RAW 0 23 #define SOCK_PACKET 1 24 #define SOCK_DGRAM 2 25 #define SOCK_STREAM 3 26 27 #define INADDR_ANY 0xFFFFFFFF 28 29 #define IPPROTO_UDP 1 30 31 #define ETH_ALEN 6 /**< HW address length */ 32 33 struct sockaddr { 34 uint16_t tra_port; 35 36 uint16_t ipv4_proto; 37 uint32_t ipv4_addr; 38 39 // protocol field is only used by "connect"-handler 40 uint16_t llc_proto; 41 uint8_t mac_addr[ETH_ALEN]; 42 }; 43 44 int socket(int, int, int, char *); 45 int sendto(int, const void *, int, int, const void *, int); 46 int send(int, const void *, int, int); 47 int recv(int, void *, int, int); 48 49 #define htonl(x) x 50 #define htons(x) x 51 52 #endif 53 54