00001 /***************************************************************************** 00002 * Copyright 2005 Daniel Ferullo * 00003 * * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); * 00005 * you may not use this file except in compliance with the License. * 00006 * You may obtain a copy of the License at * 00007 * * 00008 * http://www.apache.org/licenses/LICENSE-2.0 * 00009 * * 00010 * Unless required by applicable law or agreed to in writing, software * 00011 * distributed under the License is distributed on an "AS IS" BASIS, * 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 00013 * See the License for the specific language governing permissions and * 00014 * limitations under the License. * 00015 * * 00016 *****************************************************************************/ 00017 00018 /** 00019 * @file natblaster_peer.h 00020 * @author Daniel Ferullo (ferullo@cmu.edu) 00021 * 00022 * @brief contains the peer's entrypoint into natblaster 00023 */ 00024 00025 #ifndef __NATBLASTER_PEER_H__ 00026 #define __NATBLASTER_PEER_H__ 00027 00028 #include "def.h" 00029 00030 /** 00031 * @brief the single function a peer must call to create a natblaster TCP 00032 * connection 00033 * 00034 * @param helper_ip the helper's IP 00035 * @param helper_port the helper's port 00036 * @param peer_ip the peer's IP 00037 * @param peer_port the port the peer wants to get a TCP connection to buddy on 00038 * @param buddy_ext_ip the external IP address of the buddy 00039 * @param buddy_int_ip the internal IP address of the buddy 00040 * @param buddy_int_port the internal port the buddy will create a TCP 00041 * connection from 00042 * @param device the network device to use (if NULL it is auto detected) 00043 * @param random FLAG_SET to indicate the peer wants to have random port 00044 * allocation. This is only for development testing, and should always 00045 * be FLAG_UNSET in normal use. 00046 * 00047 * @return the TCP socket, negative if failure 00048 */ 00049 int natblaster_connect(ip_t helper_ip, port_t helper_port, ip_t peer_ip, 00050 port_t peer_port, ip_t buddy_ext_ip, ip_t buddy_int_ip, 00051 port_t buddy_int_port, char *device, flag_t random); 00052 00053 #endif /* __NATBLASTER_PEER_H__ */ 00054