{"action":"created","issue":{"url":"https://api.github.com/repos/mono/mono/issues/2006","labels_url":"https://api.github.com/repos/mono/mono/issues/2006/labels{/name}","comments_url":"https://api.github.com/repos/mono/mono/issues/2006/comments","events_url":"https://api.github.com/repos/mono/mono/issues/2006/events","html_url":"https://github.com/mono/mono/pull/2006","id":103779706,"number":2006,"title":"[Mono.Posix] Add wrappers for struct sockaddr_*","user":{"login":"steffen-kiess","id":947515,"avatar_url":"https://avatars.githubusercontent.com/u/947515?v=3","gravatar_id":"","url":"https://api.github.com/users/steffen-kiess","html_url":"https://github.com/steffen-kiess","followers_url":"https://api.github.com/users/steffen-kiess/followers","following_url":"https://api.github.com/users/steffen-kiess/following{/other_user}","gists_url":"https://api.github.com/users/steffen-kiess/gists{/gist_id}","starred_url":"https://api.github.com/users/steffen-kiess/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steffen-kiess/subscriptions","organizations_url":"https://api.github.com/users/steffen-kiess/orgs","repos_url":"https://api.github.com/users/steffen-kiess/repos","events_url":"https://api.github.com/users/steffen-kiess/events{/privacy}","received_events_url":"https://api.github.com/users/steffen-kiess/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mono/mono/labels/cla-signed","name":"cla-signed","color":"fef2c0"}],"state":"open","locked":false,"assignee":{"login":"jonpryor","id":155958,"avatar_url":"https://avatars.githubusercontent.com/u/155958?v=3","gravatar_id":"","url":"https://api.github.com/users/jonpryor","html_url":"https://github.com/jonpryor","followers_url":"https://api.github.com/users/jonpryor/followers","following_url":"https://api.github.com/users/jonpryor/following{/other_user}","gists_url":"https://api.github.com/users/jonpryor/gists{/gist_id}","starred_url":"https://api.github.com/users/jonpryor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonpryor/subscriptions","organizations_url":"https://api.github.com/users/jonpryor/orgs","repos_url":"https://api.github.com/users/jonpryor/repos","events_url":"https://api.github.com/users/jonpryor/events{/privacy}","received_events_url":"https://api.github.com/users/jonpryor/received_events","type":"User","site_admin":false},"milestone":null,"comments":5,"created_at":"2015-08-28T19:20:25Z","updated_at":"2016-01-18T14:05:51Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mono/mono/pulls/2006","html_url":"https://github.com/mono/mono/pull/2006","diff_url":"https://github.com/mono/mono/pull/2006.diff","patch_url":"https://github.com/mono/mono/pull/2006.patch"},"body":"Add wrappers for the sockaddr_* structures and add the syscalls using these\r\nstructures (bind(), accept(), ...).\r\n\r\nThis commit is the second part of https://github.com/mono/mono/pull/1977\r\n\r\nThe interface for Sockaddr* should now be easier to use (and closer to C interface).\r\n\r\nThe code also should be free of heap memory allocations for the most important cases. (In particular passing a SockaddrIn or SockaddrIn6 to sendmsg() or recvmsg()). Currently the code uses alloca() to allocate memory in sys-socket.c, if mono supports platforms without alloca() I can add a fallback to malloc(). (The alloca() is needed to allocate the native structure which has a length not known at compile time.)\r\n\r\nAll functions return ENOBUFS when the size of the returned buffer is incorrect. (I.e. if the result has to be truncated or the data is to short for an SockaddrIn or SockaddrIn6.)\r\n\r\nRegarding the byte order for the port number,  jonpryor wrote:\r\n\r\n> We should not automagically fix to/from network byte order, as even in other places of .NET you need to explicitly convert to/from network byte order, and \"magic\" here will just sow confusion. A NetworkUInt16 type is an interesting idea, but in the interests of simplicity and consistency, let's not pursue that idea.\r\n\r\nI cannot find anywhere in .NET where you have to do the byte order conversion manually. OTOH the way it is now (without automatic conversion) it is closer to the C API.\r\n\r\nThis pull request requires changes to create-native-map, see https://github.com/mono/mono-tools/pull/44\r\n"},"comment":{"url":"https://api.github.com/repos/mono/mono/issues/comments/172534448","html_url":"https://github.com/mono/mono/pull/2006#issuecomment-172534448","issue_url":"https://api.github.com/repos/mono/mono/issues/2006","id":172534448,"user":{"login":"jonpryor","id":155958,"avatar_url":"https://avatars.githubusercontent.com/u/155958?v=3","gravatar_id":"","url":"https://api.github.com/users/jonpryor","html_url":"https://github.com/jonpryor","followers_url":"https://api.github.com/users/jonpryor/followers","following_url":"https://api.github.com/users/jonpryor/following{/other_user}","gists_url":"https://api.github.com/users/jonpryor/gists{/gist_id}","starred_url":"https://api.github.com/users/jonpryor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonpryor/subscriptions","organizations_url":"https://api.github.com/users/jonpryor/orgs","repos_url":"https://api.github.com/users/jonpryor/repos","events_url":"https://api.github.com/users/jonpryor/events{/privacy}","received_events_url":"https://api.github.com/users/jonpryor/received_events","type":"User","site_admin":false},"created_at":"2016-01-18T14:05:51Z","updated_at":"2016-01-18T14:05:51Z","body":"build"}}