xref: /minix/minix/net/lwip/util.h (revision bb9622b5)
1 #ifndef MINIX_NET_LWIP_UTIL_H
2 #define MINIX_NET_LWIP_UTIL_H
3 
4 /* util.c */
5 int util_timeval_to_ticks(const struct timeval * tv, clock_t * ticksp);
6 void util_ticks_to_timeval(clock_t ticks, struct timeval * tv);
7 int util_copy_data(const struct sockdriver_data * data, size_t len, size_t off,
8 	const struct pbuf * pbuf, size_t skip, int copy_in);
9 ssize_t util_coalesce(char * buf, size_t max, const iovec_t * iov,
10 	unsigned int iovcnt);
11 int util_convert_err(err_t err);
12 int util_is_root(endpoint_t user_endpt);
13 ssize_t util_pcblist(struct rmib_call * call, struct rmib_oldp * oldp,
14 	const void *(*enum_proc)(const void *),
15 	void (*get_info_proc)(struct kinfo_pcb *, const void *));
16 
17 /*
18  * In our code, pbuf header adjustments should never fail.  This wrapper checks
19  * that the pbuf_header() call succeeds, and panics otherwise.
20  */
21 #define util_pbuf_header(pbuf,incr)					    \
22 	do {								    \
23 		if (pbuf_header((pbuf), (incr)))			    \
24 			panic("unexpected pbuf header adjustment failure"); \
25 	} while (0)
26 
27 #endif /* !MINIX_NET_LWIP_UTIL_H */
28