Change in libosmocore[master]: add osmo_ip_port API

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Mar 11 05:37:21 UTC 2019


Neels Hofmeyr has posted comments on this change. ( https://gerrit.osmocom.org/13123 )

Change subject: add osmo_ip_port API
......................................................................


Patch Set 5:

(2 comments)

https://gerrit.osmocom.org/#/c/13123/4/include/osmocom/core/ip_port.h
File include/osmocom/core/ip_port.h:

https://gerrit.osmocom.org/#/c/13123/4/include/osmocom/core/ip_port.h@47
PS4, Line 47: 
> my point was not that people should use sockaddr_storage directly, but that instead of this proposed […]
I understand the attractive / leaner approach of using operating system structs. But storing in sockaddr seems a weird choice for talking to an MGW.

For logging, the conversion is a bit cumbersome because both the IP address string and the port number need converting from sockaddr_storage. I can see a const char *osmo_sockaddr_name() function for direct logging. Next, for writing to MGCP messages I need the IP as string and a host-order uint16_t separately (or an integer in a string, but %d is good enough). The way I'd write that conversion to string and host-byte-order-port is provide an output struct for the conversion result, to avoid having to pass two out-args, and that would then be exactly struct osmo_ip_port. Argued from a different angle, these functions already allow sockaddr_storage as ip:port storage, and provide conversion to string:port and back...?

It seems that this belongs closer to MGCP, would it be ok to place this as-is in libosmo-mgcp-client instead?
(would be the least amount of work to get past this topic)

Otherwise rename to struct osmo_sockaddr_str with slightly shuffled function signatures?


https://gerrit.osmocom.org/#/c/13123/4/include/osmocom/core/ip_port.h@80
PS4, Line 80: osmo_ip_port_to_in
> this comment holds true whether or not we use sockaddr_storage, and whether or not we merge it to li […]
I was applying the object-oriented paradigm of

   function(object-instance, other arguments)

Can change to out-arg first



-- 
To view, visit https://gerrit.osmocom.org/13123
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Id617265337f09dfb6ddfe111ef5e578cd3dc9f63
Gerrit-Change-Number: 13123
Gerrit-PatchSet: 5
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-CC: Harald Welte <laforge at gnumonks.org>
Gerrit-Comment-Date: Mon, 11 Mar 2019 05:37:21 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190311/6ccbe406/attachment.htm>


More information about the gerrit-log mailing list