On 27/02/12 10:04, Stefan Götz wrote:
+ ctx->msg_ports.src_port = ntohs(saddr6->sin6_port); + }Some of the socket_wrapper functions fit in very well here.
Didn't get your point, which function?
+static struct hip_ll socket_list;What kind of socket is stored in this list? It's struct hipl_fd_info objects, right? Are there many such objects? If not it may be simpler to just use a fixed size array than a dynamic list that tends to be awkward to use (==read).
Added comments about this field.Yes, it is a list of hipl_fd_info. Since the number of open HIPL sockets is determined by the user, I think it is difficult to make it as a fixed size array.
+/** + * Add peer's hit-to-addr mapping to hadb. + * @param peer_hit peer's hit + * @param peer_addr peer's addr, v4 addr should be mapped. + * @return 0 on success, -1 otherwise. + */ +int hipl_add_peer_info(const hip_hit_t *peer_hit, + const struct in6_addr *peer_addr) +{ + return hip_hadb_add_peer_info(peer_hit, peer_addr, NULL, NULL); +}What's the point? Why not call hip_hadb_add_peer_info() in the first place?
This is an API for LIBHIPL user. We don't want user to directly handle hadb. The const correctness is applied to all functions. Xin