+
+
+char *print_ipv6(char* buf, int len, u_char* id, int id_len)
+{
+ struct sockaddr_in6 sa;
+
+ if(buf==NULL){
+ return NULL;
+ }
+
+ memcpy(&sa.sin6_addr, id, id_len);
+ sa.sin6_family=AF_INET6;
+ if(getnameinfo((struct sockaddr*)&sa, sizeof(struct sockaddr_in6),
+ buf, len, NULL,0,NI_NUMERICHOST)<0){
+ return NULL;
+ }
+ return buf;
+}
+
+char *print_ipv4(char* buf, int len, u_char* id, int id_len)
+{
+ struct sockaddr_in sa;
+
+ if(buf==NULL){
+ return NULL;
+ }
+
+ memcpy(&sa.sin_addr, id, id_len);
+ sa.sin_family=AF_INET;
+ if(getnameinfo((struct sockaddr*)&sa, sizeof(struct sockaddr_in),
+ buf, len, NULL,0,NI_NUMERICHOST)<0){
+ return NULL;
+ }
+ return buf;
+}