host_netutil.h
Go to the documentation of this file.
1 /*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2009, 2010 Willow Garage, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 * * Neither the name of the Willow Garage nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *********************************************************************/
34 
35 #ifndef _HOST_NETUTIL_H_
36 #define _HOST_NETUTIL_H_
37 
38 #include "build.h"
39 #include "list.h"
40 #include "ipcam_packet.h"
41 
42 #include <sys/socket.h>
43 #include <netinet/in.h>
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 int wge100EthGetLocalMac(const char *ifName, struct sockaddr *macAddr);
50 int wge100IpGetLocalNetmask(const char *ifName, struct in_addr *bcast);
51 int wge100IpGetLocalBcast(const char *ifName, struct in_addr *bcast);
52 int wge100IpGetLocalAddr(const char *ifName, struct in_addr *addr);
53 
54 int wge100CmdSocketCreate(const char *ifName, NetHost *localHost);
55 int wge100SocketCreate(const struct in_addr *addr, uint16_t port);
56 int wge100SocketConnect(int s, const IPAddress *ip);
57 int wge100SendUDP(int s, const IPAddress *ip, const void *data, size_t dataSize);
58 int wge100SendUDPBcast(int s, const char *ifName, const void *data, size_t dataSize);
59 
60 int wge100ArpAdd(IpCamList *camInfo);
61 int wge100ArpDel(IpCamList *camInfo);
62 
63 int wge100WaitForPacket( int *s, int nums, uint32_t type, size_t pktLen, uint32_t *wait_us );
64 
65 #define SEC_TO_USEC(sec) (1000*1000*sec)
66 
67 #ifdef __cplusplus
68 }
69 #endif
70 
71 #endif //_HOST_NETUTIL_H_
int wge100IpGetLocalAddr(const char *ifName, struct in_addr *addr)
Definition: host_netutil.c:231
int wge100SocketCreate(const struct in_addr *addr, uint16_t port)
Definition: host_netutil.c:306
int wge100WaitForPacket(int *s, int nums, uint32_t type, size_t pktLen, uint32_t *wait_us)
Definition: host_netutil.c:493
int wge100SendUDP(int s, const IPAddress *ip, const void *data, size_t dataSize)
Definition: host_netutil.c:435
int wge100ArpAdd(IpCamList *camInfo)
Definition: host_netutil.c:61
int wge100CmdSocketCreate(const char *ifName, NetHost *localHost)
Definition: host_netutil.c:387
int wge100IpGetLocalNetmask(const char *ifName, struct in_addr *bcast)
Definition: host_netutil.c:269
uint32_t IPAddress
Definition: ipcam_packet.h:74
int wge100IpGetLocalBcast(const char *ifName, struct in_addr *bcast)
Definition: host_netutil.c:193
int wge100EthGetLocalMac(const char *ifName, struct sockaddr *macAddr)
Definition: host_netutil.c:154
int wge100SocketConnect(int s, const IPAddress *ip)
Definition: host_netutil.c:353
int wge100SendUDPBcast(int s, const char *ifName, const void *data, size_t dataSize)
Definition: host_netutil.c:464
int wge100ArpDel(IpCamList *camInfo)
Definition: host_netutil.c:107


wge100_camera
Author(s): Blaise Gassend, Patrick Mihelich, Eric MacIntosh, David Palchak
autogenerated on Mon Jun 10 2019 15:44:15