| 165 | |
| 166 | |
| 167 | void PeerInterface::process(const struct sockaddr_in* peer, const char* message) |
| 168 | { |
| 169 | LOG(DEBUG) << message; |
| 170 | // The REQ HANDOVER is only watched if it is the first. |
| 171 | if (strstr(message,"HANDOVER") && ! strstr(message,"REQ HANDOVER")) WATCH(Utils::timestr() << " Peering recv:"<<message); |
| 172 | // neighbor message? |
| 173 | if (strncmp(message+3," NEIGHBOR_PARAMS",16)==0) |
| 174 | return processNeighborParams(peer,message); |
| 175 | |
| 176 | // must be handover related |
| 177 | |
| 178 | // Initial inbound handover request? |
| 179 | if (strncmp(message,"REQ HANDOVER ",13)==0) |
| 180 | return processHandoverRequest(peer,message); |
| 181 | |
| 182 | // Handover response? ("Handover Accept" in the ladder.) |
| 183 | if (strncmp(message,"RSP HANDOVER ",13)==0) |
| 184 | return processHandoverResponse(peer,message); |
| 185 | |
| 186 | // IND HANDOVER_COMPLETE |
| 187 | if (strncmp(message,"IND HANDOVER_COMPLETE ", 22)==0) |
| 188 | return processHandoverComplete(peer,message); |
| 189 | |
| 190 | // IND HANDOVER_FAILURE |
| 191 | if (strncmp(message,"IND HANDOVER_FAILURE ", 21)==0) |
| 192 | return processHandoverFailure(peer,message); |
| 193 | |
| 194 | // Other handover messages go into the FIFO map. |
| 195 | // (pat) It is an ACK message, and we need to queue it because the 'senduntilack' is running in a different thread. |
| 196 | // FIXME -- We need something here to spot malformed messages. |
| 197 | unsigned transactionID; |
| 198 | sscanf(message, "%*s %*s %u", &transactionID); |
| 199 | mFIFOMap.writeFIFO(transactionID,message); |
| 200 | } |
| 201 | |
| 202 | // Suppress fast identical ALERT messages. |
| 203 | static const unsigned alertRepeatTime = 300; |