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