/
nsime_types.hrl
83 lines (68 loc) · 3.34 KB
/
nsime_types.hrl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
%%
%% Copyright (C) 2012 Saravanan Vijayakumaran <sarva.v@gmail.com>
%%
%% This file is part of nsime.
%%
%% nsime is free software: you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
%% the Free Software Foundation, either version 3 of the License, or
%% (at your option) any later version.
%%
%% nsime is distributed in the hope that it will be useful,
%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
%% GNU General Public License for more details.
%%
%% You should have received a copy of the GNU General Public License
%% along with nsime. If not, see <http://www.gnu.org/licenses/>.
%%
%% Purpose : Nsime type definitions
%% Author : Saravanan Vijayakumaran
-type nsime_time_unit() :: sec | milli_sec | micro_sec | nano_sec.
-type nsime_time() :: {number(), nsime_time_unit()}.
-type nsime_data_rate_unit() :: bits_per_sec
| bytes_per_sec
| kilo_bits_per_sec
| kilo_bytes_per_sec
| mega_bits_per_sec
| mega_bytes_per_sec
| giga_bits_per_sec
| giga_bytes_per_sec.
-type nsime_data_rate() :: {number(), nsime_data_rate_unit()}.
-type nsime_tx_device_state() :: ready | busy.
-type nsime_callback() :: {module(), fun(), list()} | {none, none, none}.
-type nsime_address_prefix_atom() :: 255 | 254 | 252 | 248 |
240 | 224 | 192 | 128.
-type nsime_ipv4_mask() :: {nsime_address_prefix_atom(), 0, 0, 0}
| {255, nsime_address_prefix_atom(), 0, 0}
| {255, 255, nsime_address_prefix_atom(), 0}
| {255, 255, 255, nsime_address_prefix_atom()}.
-type nsime_netdevice_packet_type() :: packet_host | packet_broadcast |
packet_multicast | packet_otherhost.
-type nsime_socket_type() :: sock_stream | sock_seqpacket |
sock_dgram | sock_raw.
-type nsime_socket_error() :: error_noterror
| error_isconn
| error_notconn
| error_msgsize
| error_again
| error_shutdown
| error_opnotsupp
| error_afnosupport
| error_inval
| error_badf
| error_noroutetohost
| error_nodev
| error_addrnotavail
| error_addrinuse.
-type nsime_socket_address() :: {inet:ip_address(), inet:port_number()}.
-type nsime_layer4_receive_status() :: rx_ok
| rx_csum_failed
| rx_endpoint_closed
| rx_endpoint_unreach.
-type nsime_ipv4_drop_reason() :: drop_ttl_expired
| drop_no_route
| drop_bad_checksum
| drop_interface_down
| drop_route_error
| drop_fragment_timeout.