Electroneum
pcpserver.h
Go to the documentation of this file.
1 /* $Id: pcpserver.h,v 1.3 2014/03/24 10:49:46 nanard Exp $ */
2 /* MiniUPnP project
3  * Website : http://miniupnp.free.fr/
4  * Author : Peter Tatrai
5 
6 Copyright (c) 2013 by Cisco Systems, Inc.
7 All rights reserved.
8 
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met:
11 
12  * Redistributions of source code must retain the above copyright notice,
13  this list of conditions and the following disclaimer.
14  * Redistributions in binary form must reproduce the above copyright notice,
15  this list of conditions and the following disclaimer in the documentation
16  and/or other materials provided with the distribution.
17  * The name of the author may not be used to endorse or promote products
18  derived from this software without specific prior written permission.
19 
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef PCPSERVER_H_INCLUDED
34 #define PCPSERVER_H_INCLUDED
35 
36 #define PCP_MIN_LEN 24
37 #define PCP_MAX_LEN 1100
38 
39 struct sockaddr;
40 
41 /*
42  * receiveraddr is only used for IPV6
43  *
44  * returns 0 upon success 1 otherwise
45  */
46 int ProcessIncomingPCPPacket(int s, unsigned char *msg_buff, int len,
47  const struct sockaddr *senderaddr,
48  const struct sockaddr_in6 *receiveraddr);
49 
50 /*
51  * returns the socket
52  */
53 int OpenAndConfPCPv6Socket(void);
54 
55 
56 /*
57  * To be called when Public IP address changed (IPv4)
58  */
59 #ifdef ENABLE_IPV6
60 void PCPPublicAddressChanged(int * sockets, int n_sockets, int socket6);
61 #else /* IPV4 Only */
62 void PCPPublicAddressChanged(int * sockets, int n_sockets);
63 #endif
64 
65 #endif /* PCPSERVER_H_INCLUDED */
int OpenAndConfPCPv6Socket(void)
int ProcessIncomingPCPPacket(int s, unsigned char *msg_buff, int len, const struct sockaddr *senderaddr, const struct sockaddr_in6 *receiveraddr)
void PCPPublicAddressChanged(int *sockets, int n_sockets)