@@ -28,6 +28,50 @@ extern "C" {
2828#endif
2929
3030
31+ /*
32+ * The Type of Service provides an indication of the abstract
33+ * parameters of the quality of service desired. These parameters are
34+ * to be used to guide the selection of the actual service parameters
35+ * when transmitting a datagram through a particular network. Several
36+ * networks offer service precedence, which somehow treats high
37+ * precedence traffic as more important than other traffic (generally
38+ * by accepting only traffic above a certain precedence at time of high
39+ * load). The major choice is a three way tradeoff between low-delay,
40+ * high-reliability, and high-throughput.
41+ * The use of the Delay, Throughput, and Reliability indications may
42+ * increase the cost (in some sense) of the service. In many networks
43+ * better performance for one of these parameters is coupled with worse
44+ * performance on another. Except for very unusual cases at most two
45+ * of these three indications should be set.
46+ */
47+ #define NSAPI_IPTOS_TOS_MASK 0x1E
48+ #define NSAPI_IPTOS_TOS (tos ) ((tos) & IPTOS_TOS_MASK)
49+ #define NSAPI_IPTOS_LOWDELAY 0x10
50+ #define NSAPI_IPTOS_THROUGHPUT 0x08
51+ #define NSAPI_IPTOS_RELIABILITY 0x04
52+ #define NSAPI_IPTOS_LOWCOST 0x02
53+ #define NSAPI_IPTOS_MINCOST IPTOS_LOWCOST
54+
55+ /*
56+ * The Network Control precedence designation is intended to be used
57+ * within a network only. The actual use and control of that
58+ * designation is up to each network. The Internetwork Control
59+ * designation is intended for use by gateway control originators only.
60+ * If the actual use of these precedence designations is of concern to
61+ * a particular network, it is the responsibility of that network to
62+ * control the access to, and use of, those precedence designations.
63+ */
64+ #define NSAPI_IPTOS_PREC_MASK 0xe0
65+ #define NSAPI_IPTOS_PREC (tos ) ((tos) & IPTOS_PREC_MASK)
66+ #define NSAPI_IPTOS_PREC_NETCONTROL 0xe0
67+ #define NSAPI_IPTOS_PREC_INTERNETCONTROL 0xc0
68+ #define NSAPI_IPTOS_PREC_CRITIC_ECP 0xa0
69+ #define NSAPI_IPTOS_PREC_FLASHOVERRIDE 0x80
70+ #define NSAPI_IPTOS_PREC_FLASH 0x60
71+ #define NSAPI_IPTOS_PREC_IMMEDIATE 0x40
72+ #define NSAPI_IPTOS_PREC_PRIORITY 0x20
73+ #define NSAPI_IPTOS_PREC_ROUTINE 0x00
74+
3175/** Enum of standardized error codes
3276 *
3377 * Valid error codes have negative values and may
@@ -273,6 +317,7 @@ typedef enum nsapi_socket_option {
273317 NSAPI_BIND_TO_DEVICE , /*!< Bind socket network interface name*/
274318 NSAPI_LATENCY , /*!< Read estimated latency to destination */
275319 NSAPI_STAGGER , /*!< Read estimated stagger value to destination */
320+ NSAPI_IPTOS , /*!< Set IP type of service to set specific precedence */
276321} nsapi_socket_option_t ;
277322
278323typedef enum nsapi_tlssocket_level {
0 commit comments