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 peerfsm_private.h 00020 * @author Daniel Ferullo (ferullo@cmu.edu) 00021 * 00022 * @brief prototypes for private peerfsm functions 00023 */ 00024 00025 #ifndef __PEERFSM_PRIVATE_H__ 00026 #define __PEERFSM_PRIVATE_H__ 00027 00028 /** 00029 * @brief the hello state in the fsm 00030 * 00031 * @param info a pointer to the connection information 00032 * 00033 * @return SUCCESS, errorcode on failure 00034 */ 00035 errorcode peer_fsm_hello(peer_conn_info_t *info); 00036 00037 /** 00038 * @brief handles a connect again message 00039 * 00040 * @param info pointer to the peer connection information 00041 * 00042 * @return SUCCESS, errorcode on failure 00043 */ 00044 errorcode peer_fsm_conn_again(peer_conn_info_t *info); 00045 00046 /** 00047 * @brief handles a port prediction message 00048 * 00049 * @param info pointer to the peer connection information 00050 * 00051 * @return SUCCESS, errorcode on failure 00052 */ 00053 errorcode peer_fsm_check_port_pred(peer_conn_info_t *info); 00054 00055 /** 00056 * @brief handles a buddy alloc message 00057 * 00058 * @param info pointer to the peer connection information 00059 * 00060 * @return SUCCESS, errorcode on failure 00061 */ 00062 errorcode peer_fsm_buddy_alloc(peer_conn_info_t *info); 00063 00064 /** 00065 * @brief handles a buddy port message 00066 * 00067 * @param info pointer to the peer connection information 00068 * 00069 * @return SUCCESS, errorcode on failure 00070 */ 00071 errorcode peer_fsm_buddy_port(peer_conn_info_t *info); 00072 00073 /** 00074 * @brief handles starting the direct connection process 00075 * 00076 * @param info pointer to the peer connection information 00077 * 00078 * @return SUCCESS, errorcode on failure 00079 */ 00080 errorcode peer_fsm_start_direct_conn(peer_conn_info_t *info); 00081 00082 00083 /** 00084 * @brief handles forging a SYN/ACK and thus completing direct connection 00085 * 00086 * @param info pointer to the peer connection information 00087 * 00088 * @return SUCCESS, errorcode on failure 00089 */ 00090 errorcode peer_fsm_forge_syn_ack(peer_conn_info_t *info); 00091 00092 /** 00093 * @brief handles starting the bday process (when the peer is the random one) 00094 * 00095 * @param info pointer to the peer connection information 00096 * 00097 * @return SUCCESS, errorcode on failure 00098 */ 00099 errorcode peer_fsm_start_bday(peer_conn_info_t *info); 00100 00101 /** 00102 * @brief handles ending the bday process (when the peer is the random one) 00103 * 00104 * @param info pointer to the peer connection information 00105 * 00106 * @return SUCCESS, errorcode on failure 00107 */ 00108 errorcode peer_fsm_end_bday(peer_conn_info_t *info); 00109 00110 /** 00111 * @brief handles starting the reply bday process (when peer is the seq one) 00112 * 00113 * @param info pointer to the peer connection information 00114 * 00115 * @return SUCCESS, errorcode on failure 00116 */ 00117 errorcode peer_fsm_reply_bday(peer_conn_info_t *info); 00118 00119 /** 00120 * @brief handles sending the flood of synacks to the buddy 00121 * 00122 * @param info pointer to the peer connection information 00123 * 00124 * @return SUCCESS, errorcode on failure 00125 */ 00126 errorcode peer_fsm_bday_synack_flood(peer_conn_info_t *info); 00127 00128 00129 #endif /* __PEERFSM_PRIVATE_H__ */ 00130