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 directconn.h 00020 * @author Daniel Ferullo (ferullo@cmu.edu) 00021 * 00022 * @brief functions to help in attempt to make direct connection 00023 */ 00024 00025 #ifndef __DIRECTCONN_H__ 00026 #define __DIRECTCONN_H__ 00027 00028 #include "errorcodes.h" 00029 #include "peerdef.h" 00030 00031 /** @brief structure to hold argument to started direct connection thread */ 00032 struct direct_conn_connect_arg { 00033 /** @brief the peer's info struct */ 00034 peer_conn_info_t *info; 00035 } __attribute__((packed)); 00036 00037 /** @brief typedef for the direct_conn_connect_arg structure */ 00038 typedef struct direct_conn_connect_arg direct_conn_connect_arg_t; 00039 00040 /** 00041 * @brief starts the direct connection process by creating a detached thread 00042 * to make the connection 00043 * 00044 * Allocates a direct_conn_arg_t structure that it expects the started thread 00045 * to free. 00046 * 00047 * @param info pointer to the peer_conn_info_t structure will all the info 00048 * 00049 * @return SUCCESS, errorcode on failure 00050 */ 00051 errorcode start_direct_conn(peer_conn_info_t *info); 00052 00053 #endif /* __DIRECTCONN_H__ */ 00054