]> rtime.felk.cvut.cz Git - orte.git/blob - orte/include/rtl/compat_onetd.h
809dcd7a7a5e25f38cde881187e15c041da45ae4
[orte.git] / orte / include / rtl / compat_onetd.h
1 /*
2  *  $Id: compat.h,v 0.0.0.1             2003/12/19 
3  *
4  *  AUTHOR: Michal Sojka                sojka1@fel.cvut.cz
5  *
6  *  ORTE - OCERA Real-Time Ethernet     http://www.ocera.org/
7  *  --------------------------------------------------------------------
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License as published by
11  *  the Free Software Foundation; either version 2 of the License, or
12  *  (at your option) any later version.
13  *  
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *  
19  */
20
21 #ifndef _COMPAT_H
22 #define _COMPAT_H
23
24 #include <linux/if.h>
25 #include <linux/in.h>
26 #include <linux/inet.h>
27
28 #define printf rtl_printf
29 #define gettimeofday(tv, tz) do_gettimeofday(tv)
30
31 #define socket                      ocn_socket
32 #define setsockopt                  ocn_setsockopt
33 #define getsockopt                  ocn_getsockopt
34 #define ioctl                       ocn_ioctl
35 #define bind                        ocn_bind
36 #define getsockname                 ocn_getsockname
37 #define recvfrom                    ocn_recvfrom
38 #define sendto                      ocn_sendto
39 #define close                       ocn_close
40
41 static inline int atoi(const char* nptr)
42 {
43     return simple_strtol(nptr, (char **)NULL, 10);
44 }
45
46 static inline __u32 inet_addr(const char *cp)
47 {
48                     return in_aton(cp);
49 }
50
51 static char inet_ntoa_buf[16];
52 static inline char *inet_ntoa(struct in_addr in) {
53   unsigned char *octet;
54
55   octet = (unsigned char *)&(in.s_addr);
56   sprintf(inet_ntoa_buf, "%u.%u.%u.%u", octet[0], octet[1], octet[2], octet[3]);
57
58   return inet_ntoa_buf;
59 }
60
61
62 #endif /* _COMPAT_H */