Merge pull request #31 from eboasson/builtintopics
Refactor sample representation (along with a few small other details)
This commit is contained in:
commit
2e2224daea
62 changed files with 1963 additions and 1623 deletions
|
@ -271,24 +271,6 @@ extern "C" {
|
|||
OSAPI_EXPORT uint16_t
|
||||
os_sockaddr_get_port(const os_sockaddr *const sa) __nonnull_all__;
|
||||
|
||||
/**
|
||||
* Compare two IP addresses for equality - does not consider port number.
|
||||
* This is a 'straight' compare i.e. family must match and address bytes
|
||||
* must correspond. It does not consider the possibility of IPv6 mapped
|
||||
* IPv4 addresses or anything arcane like that.
|
||||
* @param sa1 First socket address
|
||||
* @param sa2 Second socket address.
|
||||
* @return true if equal, false otherwise.
|
||||
* @return Integer less than, equal to, or greater than zero if sa1 is
|
||||
* found, respectively, to be less than, to match, or be greater
|
||||
* than sa2.
|
||||
* @pre both sa1 and sa2 are valid os_sockaddr pointers.
|
||||
*/
|
||||
OSAPI_EXPORT int
|
||||
os_sockaddr_compare(
|
||||
const os_sockaddr *const sa1,
|
||||
const os_sockaddr *const sa2) __nonnull_all__ __attribute_pure__;
|
||||
|
||||
/**
|
||||
* Check if IP address of given socket address is unspecified.
|
||||
* @param sa Socket address
|
||||
|
|
|
@ -104,7 +104,7 @@ uint16_t os_sockaddr_get_port(const os_sockaddr *const sa)
|
|||
return port;
|
||||
}
|
||||
|
||||
int os_sockaddr_compare(
|
||||
static int os_sockaddr_compare(
|
||||
const os_sockaddr *const sa1,
|
||||
const os_sockaddr *const sa2)
|
||||
{
|
||||
|
@ -142,7 +142,7 @@ int os_sockaddr_compare(
|
|||
sin1 = (os_sockaddr_in *)sa1;
|
||||
sin2 = (os_sockaddr_in *)sa2;
|
||||
sz = sizeof(sin1->sin_addr);
|
||||
eq = memcmp(sin1, sin2, sizeof(*sin1));
|
||||
eq = memcmp(&sin1->sin_addr, &sin2->sin_addr, sizeof(sz));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue