MCPcopy Create free account
hub / github.com/RangeNetworks/openbts / addNeighbor

Method addNeighbor

Peering/NeighborTable.cpp:144–173  ·  view source on GitHub ↗

(pat) This just adds the address; the BSIC will be filled in later when we hear from the peer.

Source from the content-addressed store, hash-verified

142
143// (pat) This just adds the address; the BSIC will be filled in later when we hear from the peer.
144void NeighborTable::addNeighbor(const struct ::sockaddr_in* address)
145{
146 ScopedLock lock(mLock);
147 // Get a string for the sockaddr_in.
148 char addrString[256];
149 const char *ret = inet_ntop(AF_INET,&(address->sin_addr),addrString,255);
150 if (!ret) {
151 LOG(ERR) << "cannot parse peer socket address";
152 return;
153 }
154 LOG(DEBUG) << "adding " << addrString << ":" << ntohs(address->sin_port) << " to neighbor table";
155
156 char query[200];
157 sprintf(query,
158 "INSERT OR IGNORE INTO NEIGHBOR_TABLE (IPADDRESS) "
159 "VALUES ('%s:%d')",
160 addrString,(int)ntohs(address->sin_port));
161 sqlite3_command(mDB,query);
162 // flag the entry as configured
163 char *p = 1+index(query, '\'');
164 char *q = index(p, '\'');
165 *q = 0;
166 mConfigured.insert(p);
167
168 // update mBCCSet (pat - why?)
169 mBCCSet = getBCCSet();
170
171 // update mARFCNList and check for a change
172 mARFCNList = getARFCNs();
173}
174
175
176

Callers

nothing calls this directly

Calls 1

insertMethod · 0.80

Tested by

no test coverage detected