37,7 → 37,6 |
#ifndef __NET_ICMP_H__ |
#define __NET_ICMP_H__ |
|
#include <atomic.h> |
#include <fibril_sync.h> |
|
#include "../../include/icmp_codes.h" |
47,17 → 46,27 |
|
#include "icmp_header.h" |
|
/** Type definition of the ICMP reply data. |
* @see icmp_reply |
*/ |
typedef struct icmp_reply icmp_reply_t; |
|
/** Type definition of the ICMP reply data pointer. |
* @see icmp_reply |
*/ |
typedef icmp_reply_t * icmp_reply_ref; |
|
/** Type definition of the ICMP global data. |
* @see icmp_globals |
*/ |
typedef struct icmp_globals icmp_globals_t; |
|
/** Timeout locks map. |
* Maps message identifiers to timeout implementing atomic variables. |
* Sending fibril waits for its associated atomic variable to be set nonzero. |
* Receiving fibril sets the associated atomic variable with the return value. |
/** Pending replies map. |
* Maps message identifiers to the pending replies. |
* Sending fibril waits for its associated reply event. |
* Receiving fibril sets the associated reply with the return value and signals the event. |
*/ |
INT_MAP_DECLARE( time_locks, atomic_t ); |
INT_MAP_DECLARE( icmp_replies, icmp_reply_t ); |
|
/** Echo specific data field. |
* Used for bundle modules. |
64,8 → 73,22 |
* The bundle module gets an index to the assigned echo specific data while connecting. |
* The index is used in the future semi-remote calls instead of the ICMP phone. |
*/ |
GENERIC_FIELD_DECLARE( echo_data, icmp_echo_t ); |
GENERIC_FIELD_DECLARE( icmp_echo_data, icmp_echo_t ); |
|
/** ICMP reply data. |
*/ |
struct icmp_reply{ |
/** Reply result. |
*/ |
int result; |
/** Safety lock. |
*/ |
fibril_mutex_t mutex; |
/** Received or timeouted reply signaling. |
*/ |
fibril_condvar_t condvar; |
}; |
|
/** ICMP global data. |
*/ |
struct icmp_globals{ |
87,15 → 110,21 |
/** Networking module phone. |
*/ |
int net_phone; |
/** Indicates whether ICMP error reporting is enabled. |
*/ |
int error_reporting; |
/** Indicates whether ICMP echo replying (ping) is enabled. |
*/ |
int echo_replying; |
/** The last used identifier number. |
*/ |
icmp_param_t last_used_id; |
/** The budled modules assigned echo specific data. |
*/ |
echo_data_t echo_data; |
icmp_echo_data_t echo_data; |
/** Echo timeout locks. |
*/ |
time_locks_t time_locks; |
icmp_replies_t replies; |
/** Safety lock. |
*/ |
fibril_rwlock_t lock; |