]> rtime.felk.cvut.cz Git - orte/eurobot.git/blob - orte/include/rtl/compat_onetd.h
updated email address - petr@smoliku.cz
[orte/eurobot.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 atoi(const char* nptr)
52 {
53     return simple_strtol(nptr, (char **)NULL, 10);
54 }
55
56 static inline __u32 inet_addr(const char *cp)
57 {
58                     return in_aton(cp);
59 }
60
61 static char inet_ntoa_buf[16];
62 static inline char *inet_ntoa(struct in_addr in) {
63   unsigned char *octet;
64
65   octet = (unsigned char *)&(in.s_addr);
66   sprintf(inet_ntoa_buf, "%u.%u.%u.%u", octet[0], octet[1], octet[2], octet[3]);
67
68   return inet_ntoa_buf;
69 }
70
71
72 #endif /* _COMPAT_H */