00001 /* 00002 ** sockaddr.h for in /home/anoman/work/lse/atomix/lseos-net 00003 ** 00004 ** Copyright (c)2004 Arthur Kopatsy 00005 ** Login <kopats_a@epita.fr> 00006 ** 00007 ** Started on Wed Jul 28 15:53:56 2004 Arthur Kopatsy 00008 ** Last update Wed Nov 3 16:29:23 2004 Arthur Kopatsy 00009 */ 00010 00011 #ifndef SOCKADDR_H_ 00012 #define SOCKADDR_H_ 00013 00014 #define AF_LINK 0 00015 #define AF_INET 1 00016 00017 typedef size_t socklen_t; 00018 00019 struct s_iface; 00020 00021 typedef struct sockaddr 00022 { 00023 u_int8_t sa_len; 00024 u_int8_t sa_family; 00025 u_int8_t sa_data[14]; 00026 } t_sockaddr; 00027 00028 /* 00029 ** sockaddr_eth 00030 */ 00031 00032 #define MAC_ADDR_SIZE 6 00033 00034 struct mac_addr { 00035 unsigned char s_addr[MAC_ADDR_SIZE]; 00036 }; 00037 00038 struct sockaddr_mac { 00039 u_int8_t smac_len; 00040 u_int8_t smac_family; 00041 struct mac_addr smac_addr; 00042 u_int8_t smac_zero[8]; 00043 }; 00044 00045 /* 00046 ** sockaddr_in 00047 */ 00048 00049 #define IP_ADDR_SIZE 4 00050 00051 struct in_addr { 00052 u_int32_t s_addr; 00053 }; 00054 00055 struct sockaddr_in { 00056 u_int8_t sin_len; 00057 u_int8_t sin_family; 00058 u_int16_t sin_port; 00059 struct in_addr sin_addr; 00060 u_int8_t sin_zero[8]; 00061 }; 00062 00063 #endif