Project Alice
Loading...
Searching...
No Matches
unp.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2013 by Cisco Systems, Inc.
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7
8 1. Redistributions of source code must retain the above copyright notice, this
9 list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright notice,
11 this list of conditions and the following disclaimer in the documentation
12 and/or other materials provided with the distribution.
13
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef __unp_h
27#define __unp_h
28
29#ifdef WIN32
30#include <winsock2.h>
31#include <ws2tcpip.h>
32#else
33#include <unistd.h>
34#include <sys/time.h>
35#include <sys/socket.h>
36#include <netinet/in.h>
37#include <arpa/inet.h>
38#endif
39
40#include "pcp_socket.h"
41
42#define SA struct sockaddr
43
44char *sock_ntop(const SA *, socklen_t);
45char *sock_ntop_host(const SA *, socklen_t);
46char *Sock_ntop(const SA *, socklen_t);
47char *Sock_ntop_host(const SA *, socklen_t);
49
50int sock_pton(const char* cp, struct sockaddr *sa);
51int
52sock_pton_with_prefix(const char* cp, struct sockaddr *sa, int *int_prefix);
53struct sockaddr *Sock_pton(const char* cp);
54
55void err_dump(const char *, ...);
56void err_msg(const char *, ...);
57void err_quit(const char *, ...);
58void err_ret(const char *, ...);
59void err_sys(const char *, ...);
60
61#endif /* __unp_h */
struct sockaddr * Sock_pton(const char *cp)
Definition: sock_ntop.c:217
char * sock_ntop(const SA *, socklen_t)
#define SA
Definition: unp.h:42
char * Sock_ntop(const SA *, socklen_t)
void err_msg(const char *,...)
void err_sys(const char *,...)
int Sockfd_to_family(int)
void err_dump(const char *,...)
void err_quit(const char *,...)
void err_ret(const char *,...)
int sock_pton(const char *cp, struct sockaddr *sa)
Definition: sock_ntop.c:119
char * Sock_ntop_host(const SA *, socklen_t)
char * sock_ntop_host(const SA *, socklen_t)
int sock_pton_with_prefix(const char *cp, struct sockaddr *sa, int *int_prefix)
Definition: sock_ntop.c:228