Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4703 → Rev 4704

/branches/network/uspace/srv/net/il/il_messages.h
70,6 → 70,10
NET_IL_MTU_CHANGED
} il_messages;
 
/** @name Internetwork layer specific message parameters definitions
*/
/*@{*/
 
/** Returns the protocol number message parameter.
* @param call The message call structure. Input parameter.
*/
80,6 → 84,8
*/
#define IL_GET_SERVICE( call ) ( services_t ) IPC_GET_ARG2( * call )
 
/*@}*/
 
#endif
 
/** @}
/branches/network/uspace/srv/net/il/arp/arp_messages.h
67,11 → 67,17
NET_ARP_CLEAN_CACHE,
} arp_messages;
 
/** @name ARP specific message parameters definitions
*/
/*@{*/
 
/** Returns the protocol service message parameter.
* @param call The message call structure. Input parameter.
*/
#define ARP_GET_NETIF( call ) ( services_t ) IPC_GET_ARG2( * call )
 
/*@}*/
 
#endif
 
/** @}
/branches/network/uspace/srv/net/il/arp/arp.h
127,10 → 127,10
/** Broadcast device hardware address data.
*/
char * broadcast_data;
/** Device driver service.
/** Device module service.
*/
services_t service;
/** Driver phone.
/** Device module phone.
*/
int phone;
/** Protocol map.
/branches/network/uspace/srv/net/il/arp/arp_oc.h
38,6 → 38,10
#ifndef __NET_ARP_ARPOP_H__
#define __NET_ARP_ARPOP_H__
 
/** @name ARP operation codes definitions
*/
/*@{*/
 
/** REQUEST operation code.
*/
#define ARPOP_REQUEST 1
130,6 → 134,8
*/
#define ARPOP_MAPOS_UNARP 23
 
/*@}*/
 
#endif
 
/** @}
/branches/network/uspace/srv/net/il/ip/ip_module.h
31,6 → 31,8
*/
 
/** @file
* IP module functions.
* The functions are used as IP module entry points.
*/
 
#ifndef __NET_IP_MODULE_H__
38,7 → 40,24
 
#include <ipc/ipc.h>
 
/** Initializes the IP module.
* @param client_connection The client connection processing function. The module skeleton propagates its own one. Input parameter.
* @returns EOK on success.
* @returns ENOMEM if there is not enough memory left.
*/
int ip_initialize( async_client_conn_t client_connection );
 
/** Processes the IP message.
* @param callid The message identifier. Input parameter.
* @param call The message parameters. Input parameter.
* @param answer The message answer parameters. Output parameter.
* @param answer_count The last parameter for the actual answer in the answer parameter. Output parameter.
* @returns EOK on success.
* @returns ENOTSUP if the message is not known.
* @see ip_interface.h
* @see il_interface.h
* @see IS_NET_IP_MESSAGE()
*/
int ip_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
 
#endif
/branches/network/uspace/srv/net/il/ip/ip_remote.c
31,6 → 31,9
*/
 
/** @file
* IP interface implementation for standalone remote modules.
* @see ip_interface.h
* @see il_interface.h
*/
 
#include <ipc/services.h>
/branches/network/uspace/srv/net/il/ip/ip_messages.h
31,7 → 31,7
*/
 
/** @file
* Internet protocol layer module messages.
* IP module messages.
* @see ip_interface.h
*/
 
40,7 → 40,7
 
#include <ipc/ipc.h>
 
/** Internet protocol layer module messages.
/** IP module messages.
*/
typedef enum{
/** Adds the routing entry.
53,6 → 53,10
NET_IP_SET_GATEWAY
} ip_messages;
 
/** @name IP specific message parameters definitions
*/
/*@{*/
 
/** Returns the gateway message parameter.
* @param call The message call structure. Input parameter.
*/
68,6 → 72,8
*/
#define IP_GET_NETMASK( call ) ({ in_addr_t addr; addr.s_addr = IPC_GET_ARG4( * call ); addr; })
 
/*@}*/
 
#endif
 
/** @}
/branches/network/uspace/srv/net/il/ip/ip_header.h
31,7 → 31,7
*/
 
/** @file
* Internet protocol header and options definitions.
* IP header and options definitions.
* Names according to the linux src/include/linux/ip.h header file.
*/
 
87,6 → 87,7
uint16_t identification;
#ifdef ARCH_IS_BIG_ENDIAN
/** Various control flags.
* @see
*/
uint16_t flags:3;
/** This field indicates where in the datagram this fragment belongs.
165,15 → 166,40
#endif
} __attribute__ ((packed));
 
/** @name IP flags definitions
*/
/*@{*/
 
/** Fragment flag field shift.
*/
#define IPFLAG_FRAGMENT_SHIFT 1
 
/** Fragmented flag field shift.
*/
#define IPFLAG_FRAGMENTED_SHIFT 0
 
/** May fragment flag value.
* Allows the packet fragmentation.
*/
#define IPFLAG_MAY_FRAGMENT ( 0x0 << IPFLAG_FRAGMENT_SHIFT )
 
/** Don't fragment flag value.
* Permits the packet fragmentation.
*/
#define IPFLAG_DONT_FRAGMENT ( 0x1 << IPFLAG_FRAGMENT_SHIFT )
 
/** Last fragment flag value.
* Indicates the last packet fragment.
*/
#define IPFLAG_LAST_FRAGMENT ( 0x0 << IPFLAG_FRAGMENTED_SHIFT )
 
/** More fragments flag value.
* Indicates that more packet fragments follow.
*/
#define IPFLAG_MORE_FRAGMENTS ( 0x1 << IPFLAG_FRAGMENTED_SHIFT )
 
/*@}*/
 
/*
#define IPOPT_OPTVAL 0
#define IPOPT_OLEN 1
/branches/network/uspace/srv/net/il/ip/ip_client.c
30,8 → 30,9
* @{
*/
 
/**
* @file
/** @file
* IP client interface implementation.
* @see ip_client.h
*/
 
#include <errno.h>
/branches/network/uspace/srv/net/il/ip/ip.h
30,8 → 30,8
* @{
*/
 
/**
* @file
/** @file
* IP module.
*/
 
#ifndef __NET_IP_H__
50,35 → 50,97
#include "../../structures/generic_field.h"
#include "../../structures/module_map.h"
 
/** Type definition of the IP global data.
* @see ip_globals
*/
typedef struct ip_globals ip_globals_t;
 
/** Type definition of the IP network interface specific data.
* @see ip_netif
*/
typedef struct ip_netif ip_netif_t;
 
/** Type definition of the IP network interface specific data pointer.
* @see ip_netif
*/
typedef ip_netif_t * ip_netif_ref;
 
/** Type definition of the IP protocol specific data.
* @see ip_proto
*/
typedef struct ip_proto ip_proto_t;
 
/** Type definition of the IP protocol specific data pointer.
* @see ip_proto
*/
typedef ip_proto_t * ip_proto_ref;
 
/** Type definition of the IP route specific data.
* @see ip_route
*/
typedef struct ip_route ip_route_t;
 
/** Type definition of the IP route specific data pointer.
* @see ip_route
*/
typedef ip_route_t * ip_route_ref;
 
typedef struct ip_globals ip_globals_t;
 
/** IP network interfaces.
* Maps devices to the IP network interface specific data.
* @see device.h
*/
DEVICE_MAP_DECLARE( ip_netifs, ip_netif_t )
 
/** IP registered protocols.
* Maps protocols to the IP protocol specific data.
* @see int_map.h
*/
INT_MAP_DECLARE( ip_protos, ip_proto_t )
 
/** IP routing table.
* @see generic_field.h
*/
GENERIC_FIELD_DECLARE( ip_routes, ip_route_t )
 
/** IP network interface specific data.
*/
struct ip_netif{
/** Device identifier.
*/
device_id_t device_id;
/** Netif module service.
*/
services_t service;
/** Netif module phone.
*/
int phone;
/** ARP module.
* Assigned if using ARP.
*/
module_ref arp;
/** IP version.
*/
int ipv;
/** Indicates whether using DHCP.
*/
int dhcp;
/** Indicates whether IP routing is enabled.
*/
int routing;
/** Device state.
*/
device_state_t state;
/** Broadcast address.
*/
in_addr_t broadcast;
/** First DNS address.
*/
in_addr_t dns1;
/** Second DNS address.
*/
in_addr_t dns2;
/** Routing table.
*/
ip_routes_t routes;
/** Reserved packet prefix length.
*/
95,30 → 157,72
size_t addr_len;
};
 
/** IP protocol specific data.
*/
struct ip_proto{
/** Protocol number.
*/
int protocol;
/** Protocol module service.
*/
services_t service;
/** Protocol module phone.
*/
int phone;
/** Protocol packet receiving function.
*/
tl_received_msg_t received_msg;
};
 
/** IP route specific data.
*/
struct ip_route{
/** Target address.
*/
in_addr_t address;
/** Target network mask.
*/
in_addr_t netmask;
/** Gateway.
*/
in_addr_t gateway;
/** Parent netif.
*/
ip_netif_ref netif;
};
 
/** IP global data.
*/
struct ip_globals{
/** Networking module phone.
*/
int net_phone;
/** Registered network interfaces.
*/
ip_netifs_t netifs;
/** Netifs safeyt lock.
*/
fibril_rwlock_t netifs_lock;
/** Registered protocols.
*/
ip_protos_t protos;
/** Protocols safety lock.
*/
fibril_rwlock_t protos_lock;
/** Default gateway.
*/
ip_route_t gateway;
/** Known support modules.
*/
modules_t modules;
/** Default client connection function for support modules.
*/
async_client_conn_t client_connection;
/** Packet counter.
*/
uint16_t packet_counter;
/** Safety lock.
*/
fibril_rwlock_t lock;
};
 
/branches/network/uspace/srv/net/il/ip/ip_module.c
31,6 → 31,10
*/
 
/** @file
* IP standalone module implementation.
* Contains skeleton module functions mapping.
* The functions are used by the module skeleton as module specific entry points.
* @see module.c
*/
 
#include <async.h>
49,12 → 53,36
#include "ip.h"
#include "ip_module.h"
 
/** IP module name.
*/
#define NAME "IP protocol"
 
/** Prints the module name.
* @see NAME
*/
void module_print_name( void );
 
/** Starts the IP module.
* Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop.
* @param client_connection The client connection processing function. The module skeleton propagates its own one. Input parameter.
* @returns EOK on successful module termination.
* @returns Other error codes as defined for the ip_initialize() function.
* @returns Other error codes as defined for the REGISTER_ME() macro function.
*/
int module_start( async_client_conn_t client_connection );
 
/** Processes the IP message.
* @param callid The message identifier. Input parameter.
* @param call The message parameters. Input parameter.
* @param answer The message answer parameters. Output parameter.
* @param answer_count The last parameter for the actual answer in the answer parameter. Output parameter.
* @returns EOK on success.
* @returns Other error codes as defined for the ip_message() function.
*/
int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count );
 
/** IP module global data.
*/
extern ip_globals_t ip_globals;
 
void module_print_name( void ){