فهرست منبع

Remove ns_bzero(), ns_bcopy(), and ns_bcmp()

Do not overload bzero(), bcopy(), and bcmp() from strings.h
Bradley T. Hughes 6 سال پیش
والد
کامیت
7a43aae7c3

+ 5 - 5
src/apps/common/apputils.c

@@ -979,7 +979,7 @@ char *base64_encode(const unsigned char *data,
 void build_base64_decoding_table() {
 
     decoding_table = (char*)malloc(256);
-    ns_bzero(decoding_table,256);
+    bzero(decoding_table,256);
 
     int i;
     for (i = 0; i < 64; i++)
@@ -1114,19 +1114,19 @@ void convert_oauth_key_data_raw(const oauth_key_data_raw *raw, oauth_key_data *o
 {
 	if(raw && oakd) {
 
-		ns_bzero(oakd,sizeof(oauth_key_data));
+		bzero(oakd,sizeof(oauth_key_data));
 
 		oakd->timestamp = (turn_time_t)raw->timestamp;
 		oakd->lifetime = raw->lifetime;
 
-		ns_bcopy(raw->as_rs_alg,oakd->as_rs_alg,sizeof(oakd->as_rs_alg));
-		ns_bcopy(raw->kid,oakd->kid,sizeof(oakd->kid));
+		bcopy(raw->as_rs_alg,oakd->as_rs_alg,sizeof(oakd->as_rs_alg));
+		bcopy(raw->kid,oakd->kid,sizeof(oakd->kid));
 
 		if(raw->ikm_key[0]) {
 			size_t ikm_key_size = 0;
 			char *ikm_key = (char*)base64_decode(raw->ikm_key,strlen(raw->ikm_key),&ikm_key_size);
 			if(ikm_key) {
-				ns_bcopy(ikm_key,oakd->ikm_key,ikm_key_size);
+				bcopy(ikm_key,oakd->ikm_key,ikm_key_size);
 				oakd->ikm_key_size = ikm_key_size;
 				free(ikm_key);
 			}

+ 1 - 1
src/apps/common/hiredis_libevent2.c

@@ -247,7 +247,7 @@ redis_context_handle redisLibeventAttach(struct event_base *base, char *ip0, int
 
   /* Create container for context and r/w events */
   e = (struct redisLibeventEvents*)malloc(sizeof(struct redisLibeventEvents));
-  ns_bzero(e,sizeof(struct redisLibeventEvents));
+  bzero(e,sizeof(struct redisLibeventEvents));
 
   e->allocated = 1;
   e->context = ac;

+ 1 - 1
src/apps/common/ns_turn_utils.c

@@ -615,7 +615,7 @@ int get_canonic_origin(const char* o, char *co, int sz)
 					const char *host = evhttp_uri_get_host(uri);
 					if(host && host[0]) {
 						char otmp[STUN_MAX_ORIGIN_SIZE+STUN_MAX_ORIGIN_SIZE];
-						ns_bcopy(scheme,otmp,schlen);
+						bcopy(scheme,otmp,schlen);
 						otmp[schlen]=0;
 
 						{

+ 1 - 1
src/apps/common/stun_buffer.c

@@ -34,7 +34,7 @@
 
 int stun_init_buffer(stun_buffer *buf) {
   if(!buf) return -1;
-  ns_bzero(buf->buf,sizeof(buf->buf));
+  bzero(buf->buf,sizeof(buf->buf));
   buf->len=0;
   buf->offset=0;
   buf->coffset=0;

+ 2 - 2
src/apps/natdiscovery/natdiscovery.c

@@ -631,8 +631,8 @@ int main(int argc, char **argv)
 	set_logfile("stdout");
 	set_system_parameters(0);
 
-	ns_bzero(local_addr_string, sizeof(local_addr_string));
-	ns_bzero(local2_addr_string, sizeof(local2_addr_string));
+	bzero(local_addr_string, sizeof(local_addr_string));
+	bzero(local2_addr_string, sizeof(local2_addr_string));
 	addr_set_any(&remote_addr);
 	addr_set_any(&other_addr);
 	addr_set_any(&reflexive_addr);

+ 7 - 7
src/apps/oauth/oauth.c

@@ -62,14 +62,14 @@ static int setup_ikm_key(const char *kid,
                         const char *as_rs_alg, 
                         oauth_key *key) { 
 
-        ns_bzero(key,sizeof(*key));
+        bzero(key,sizeof(*key));
 
         oauth_key_data okd;
-        ns_bzero(&okd,sizeof(okd));
+        bzero(&okd,sizeof(okd));
 
         {
                 oauth_key_data_raw okdr;
-                ns_bzero(&okdr,sizeof(okdr));
+                bzero(&okdr,sizeof(okdr));
 
                 STRCPY(okdr.kid,kid);
                 STRCPY(okdr.ikm_key,ikm_key);
@@ -103,7 +103,7 @@ static int encode_token(const char* server_name,
 
 
         oauth_token ot;
-        ns_bzero(&ot,sizeof(ot));
+        bzero(&ot,sizeof(ot));
 
         const size_t mac_key_length=strlen(mac_key);
         ot.enc_block.key_length = (uint16_t)mac_key_length;
@@ -112,7 +112,7 @@ static int encode_token(const char* server_name,
         ot.enc_block.lifetime = token_lifetime;
 
         encoded_oauth_token etoken;
-        ns_bzero(&etoken,sizeof(etoken));
+        bzero(&etoken,sizeof(etoken));
 
         // TODO: avoid this hack
         if (!*gcm_nonce) gcm_nonce=NULL;
@@ -135,10 +135,10 @@ static int validate_decode_token(const char* server_name,
                         const char* base64encoded_etoken, oauth_token* dot) {
 
         
-        ns_bzero((dot),sizeof(*dot));
+        bzero((dot),sizeof(*dot));
 
         encoded_oauth_token etoken;
-        ns_bzero(&etoken,sizeof(etoken));
+        bzero(&etoken,sizeof(etoken));
 
         const size_t base64encoded_etoken_length=strlen(base64encoded_etoken);
         const unsigned char *tmp = base64_decode(base64encoded_etoken,base64encoded_etoken_length,&etoken.size);

+ 1 - 1
src/apps/peer/udpserver.c

@@ -106,7 +106,7 @@ static server_type* init_server(int verbose, const char* ifname, char **local_ad
 
   if(!server) return server;
 
-  ns_bzero(server,sizeof(server_type));
+  bzero(server,sizeof(server_type));
 
   server->verbose=verbose;
 

+ 3 - 3
src/apps/relay/dbdrivers/dbd_mongo.c

@@ -221,7 +221,7 @@ static int mongo_get_user_key(u08bits *usname, u08bits *realm, hmackey_t key) {
 					TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Wrong key format: string length=%d (must be %d): user %s\n", (int)length, (int)sz, usname);
 				} else {
 					char kval[sizeof(hmackey_t) + sizeof(hmackey_t) + 1];
-					ns_bcopy(value, kval, sz);
+					bcopy(value, kval, sz);
 					kval[sz] = 0;
 					if(convert_string_key_to_binary(kval, key, sz / 2) < 0) {
 						TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Wrong key: %s, user %s\n", kval, usname);
@@ -264,7 +264,7 @@ static int mongo_get_oauth_key(const u08bits *kid, oauth_key_data_raw *key) {
 
 	int ret = -1;
 
-	ns_bzero(key,sizeof(oauth_key_data_raw));
+	bzero(key,sizeof(oauth_key_data_raw));
 	STRCPY(key->kid,kid);
 
 	if (!cursor) {
@@ -524,7 +524,7 @@ static int mongo_list_oauth_keys(secrets_list_t *kids,secrets_list_t *teas,secre
     bson_iter_t iter;
     while (mongoc_cursor_next(cursor, &item)) {
 
-    	ns_bzero(key,sizeof(oauth_key_data_raw));
+    	bzero(key,sizeof(oauth_key_data_raw));
     	if (bson_iter_init(&iter, item) && bson_iter_find(&iter, "kid") && BSON_ITER_HOLDS_UTF8(&iter)) {
     		STRCPY(key->kid,bson_iter_utf8(&iter, &length));
     	}

+ 21 - 21
src/apps/relay/dbdrivers/dbd_mysql.c

@@ -70,7 +70,7 @@ static void MyconninfoFree(Myconninfo *co) {
 		if(co->cert) free(co->cert);
 		if(co->capath) free(co->capath);
 		if(co->cipher) free(co->cipher);
-		ns_bzero(co,sizeof(Myconninfo));
+		bzero(co,sizeof(Myconninfo));
 	}
 }
 
@@ -104,7 +104,7 @@ char* decryptPassword(char* in, const unsigned char* mykey){
 
 static Myconninfo *MyconninfoParse(char *userdb, char **errmsg) {
 	Myconninfo *co = (Myconninfo*)malloc(sizeof(Myconninfo));
-	ns_bzero(co,sizeof(Myconninfo));
+	bzero(co,sizeof(Myconninfo));
 	if(userdb) {
 		char *s0=strdup(userdb);
 		char *s = s0;
@@ -323,7 +323,7 @@ static int mysql_get_auth_secrets(secrets_list_t *sl, u08bits *realm) {
 							if(lengths) {
 								size_t sz = lengths[0];
 								char auth_secret[TURN_LONG_STRING_SIZE];
-								ns_bcopy(row[0],auth_secret,sz);
+								bcopy(row[0],auth_secret,sz);
 								auth_secret[sz]=0;
 								add_to_secrets_list(sl,auth_secret);
 							}
@@ -366,7 +366,7 @@ static int mysql_get_user_key(u08bits *usname, u08bits *realm, hmackey_t key) {
 							TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Wrong key format: string length=%d (must be %d): user %s\n",(int)lengths[0],(int)sz,usname);
 						} else {
 							char kval[sizeof(hmackey_t)+sizeof(hmackey_t)+1];
-							ns_bcopy(row[0],kval,sz);
+							bcopy(row[0],kval,sz);
 							kval[sz]=0;
 							if(convert_string_key_to_binary(kval, key, sz/2)<0) {
 								TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Wrong key: %s, user %s\n",kval,usname);
@@ -409,23 +409,23 @@ static int mysql_get_oauth_key(const u08bits *kid, oauth_key_data_raw *key) {
 					unsigned long *lengths = mysql_fetch_lengths(mres);
 					if(lengths) {
 						STRCPY(key->kid,kid);
-						ns_bcopy(row[0],key->ikm_key,lengths[0]);
+						bcopy(row[0],key->ikm_key,lengths[0]);
 						key->ikm_key[lengths[0]]=0;
 
 						char stimestamp[128];
-						ns_bcopy(row[1],stimestamp,lengths[1]);
+						bcopy(row[1],stimestamp,lengths[1]);
 						stimestamp[lengths[1]]=0;
 						key->timestamp = (u64bits)strtoull(stimestamp,NULL,10);
 
 						char slifetime[128];
-						ns_bcopy(row[2],slifetime,lengths[2]);
+						bcopy(row[2],slifetime,lengths[2]);
 						slifetime[lengths[2]]=0;
 						key->lifetime = (u32bits)strtoul(slifetime,NULL,10);
 
-						ns_bcopy(row[3],key->as_rs_alg,lengths[3]);
+						bcopy(row[3],key->as_rs_alg,lengths[3]);
 						key->as_rs_alg[lengths[3]]=0;
 
-						ns_bcopy(row[4],key->realm,lengths[4]);
+						bcopy(row[4],key->realm,lengths[4]);
 						key->realm[lengths[4]]=0;
 
 						ret = 0;
@@ -465,26 +465,26 @@ static int mysql_list_oauth_keys(secrets_list_t *kids,secrets_list_t *teas,secre
 					unsigned long *lengths = mysql_fetch_lengths(mres);
 					if(lengths) {
 
-						ns_bcopy(row[0],key->ikm_key,lengths[0]);
+						bcopy(row[0],key->ikm_key,lengths[0]);
 						key->ikm_key[lengths[0]]=0;
 
 						char stimestamp[128];
-						ns_bcopy(row[1],stimestamp,lengths[1]);
+						bcopy(row[1],stimestamp,lengths[1]);
 						stimestamp[lengths[1]]=0;
 						key->timestamp = (u64bits)strtoull(stimestamp,NULL,10);
 
 						char slifetime[128];
-						ns_bcopy(row[2],slifetime,lengths[2]);
+						bcopy(row[2],slifetime,lengths[2]);
 						slifetime[lengths[2]]=0;
 						key->lifetime = (u32bits)strtoul(slifetime,NULL,10);
 
-						ns_bcopy(row[3],key->as_rs_alg,lengths[3]);
+						bcopy(row[3],key->as_rs_alg,lengths[3]);
 						key->as_rs_alg[lengths[3]]=0;
 
-						ns_bcopy(row[4],key->realm,lengths[4]);
+						bcopy(row[4],key->realm,lengths[4]);
 						key->realm[lengths[4]]=0;
 
-						ns_bcopy(row[5],key->kid,lengths[5]);
+						bcopy(row[5],key->kid,lengths[5]);
 						key->kid[lengths[5]]=0;
 
 						if(kids) {
@@ -999,11 +999,11 @@ static int mysql_get_ip_list(const char *kind, ip_range_list_t * list) {
 							if(lengths) {
 								size_t sz = lengths[0];
 								char kval[TURN_LONG_STRING_SIZE];
-								ns_bcopy(row[0],kval,sz);
+								bcopy(row[0],kval,sz);
 								kval[sz]=0;
 								sz = lengths[1];
 								char rval[TURN_LONG_STRING_SIZE];
-								ns_bcopy(row[1],rval,sz);
+								bcopy(row[1],rval,sz);
 								rval[sz]=0;
 								add_ip_list_range(kval,rval,list);
 							}
@@ -1043,7 +1043,7 @@ static void mysql_reread_realms(secrets_list_t * realms_list) {
 								if(lengths) {
 									size_t sz = lengths[0];
 									char oval[513];
-									ns_bcopy(row[0],oval,sz);
+									bcopy(row[0],oval,sz);
 									oval[sz]=0;
 									char *rval=strdup(row[1]);
 									get_realm(rval);
@@ -1106,15 +1106,15 @@ static void mysql_reread_realms(secrets_list_t * realms_list) {
 							if(lengths) {
 								char rval[513];
 								size_t sz = lengths[0];
-								ns_bcopy(row[0],rval,sz);
+								bcopy(row[0],rval,sz);
 								rval[sz]=0;
 								char oval[513];
 								sz = lengths[1];
-								ns_bcopy(row[1],oval,sz);
+								bcopy(row[1],oval,sz);
 								oval[sz]=0;
 								char vval[513];
 								sz = lengths[2];
-								ns_bcopy(row[2],vval,sz);
+								bcopy(row[2],vval,sz);
 								vval[sz]=0;
 								realm_params_t* rp = get_realm(rval);
 								if(!strcmp(oval,"max-bps"))

+ 3 - 3
src/apps/relay/dbdrivers/dbd_redis.c

@@ -61,13 +61,13 @@ static void RyconninfoFree(Ryconninfo *co) {
 		if(co->host) free(co->host);
 		if(co->dbname) free(co->dbname);
 		if(co->password) free(co->password);
-		ns_bzero(co,sizeof(Ryconninfo));
+		bzero(co,sizeof(Ryconninfo));
 	}
 }
 
 static Ryconninfo *RyconninfoParse(const char *userdb, char **errmsg) {
 	Ryconninfo *co = (Ryconninfo*) malloc(sizeof(Ryconninfo));
-	ns_bzero(co,sizeof(Ryconninfo));
+	bzero(co,sizeof(Ryconninfo));
 	if (userdb) {
 		char *s0 = strdup(userdb);
 		char *s = s0;
@@ -459,7 +459,7 @@ static int redis_get_oauth_key(const u08bits *kid, oauth_key_data_raw *key) {
   redisContext * rc = get_redis_connection();
   if(rc) {
 	char s[TURN_LONG_STRING_SIZE];
-	ns_bzero(key,sizeof(oauth_key_data_raw));
+	bzero(key,sizeof(oauth_key_data_raw));
 	STRCPY(key->kid,kid);
 	snprintf(s,sizeof(s),"hgetall turn/oauth/kid/%s", (const char*)kid);
 	redisReply *reply = (redisReply *)redisCommand(rc, s);

+ 1 - 1
src/apps/relay/dtls_listener.c

@@ -503,7 +503,7 @@ static int create_new_connected_udp_socket(
 		return -1;
 	}
 
-	ns_bzero(ret, sizeof(ioa_socket));
+	bzero(ret, sizeof(ioa_socket));
 
 	ret->magic = SOCKET_MAGIC;
 

+ 8 - 8
src/apps/relay/http_server.c

@@ -66,7 +66,7 @@ static void write_http_echo(ioa_socket_handle s)
 			snprintf(content_http,sizeof(content_http)-1,"<!DOCTYPE html>\r\n<html>\r\n  <head>\r\n    <title>%s</title>\r\n  </head>\r\n  <body>\r\n    <b>%s</b> <br> <b><i>use https connection for the admin session</i></b>\r\n  </body>\r\n</html>\r\n",title,title);
 			snprintf(data_http,sizeof(data_http)-1,"HTTP/1.0 200 OK\r\nServer: %s\r\nContent-Type: text/html; charset=UTF-8\r\nContent-Length: %d\r\n\r\n%.906s",TURN_SOFTWARE,(int)strlen(content_http),content_http);
 			len_http = strlen(data_http);
-			ns_bcopy(data_http,data,len_http);
+			bcopy(data_http,data,len_http);
 			ioa_network_buffer_set_size(nbh_http,len_http);
 			send_data_from_ioa_socket_nbh(s, NULL, nbh_http, TTL_IGNORE, TOS_IGNORE,NULL);
 		}
@@ -109,7 +109,7 @@ static struct headers_list * post_parse(char *data, size_t data_len)
 	char *fmarker = NULL;
 	char *fsplit = strtok_r(post_data, "&", &fmarker);
 	struct headers_list *list = (struct headers_list*)malloc(sizeof(struct headers_list));
-	ns_bzero(list,sizeof(struct headers_list));
+	bzero(list,sizeof(struct headers_list));
 	while (fsplit != NULL) {
 		char *vmarker = NULL;
 		char *key = strtok_r(fsplit, "=", &vmarker);
@@ -156,13 +156,13 @@ static struct http_request* parse_http_request_1(struct http_request* ret, char*
 				const char *query = evhttp_uri_get_query(uri);
 				if(query) {
 					struct evkeyvalq* kv = (struct evkeyvalq*)malloc(sizeof(struct evkeyvalq));
-					ns_bzero(kv,sizeof(struct evkeyvalq));
+					bzero(kv,sizeof(struct evkeyvalq));
 					if(evhttp_parse_query_str(query, kv)<0) {
 						free(ret);
 						ret = NULL;
 					} else {
 						ret->headers = (struct http_headers*)malloc(sizeof(struct http_headers));
-						ns_bzero(ret->headers,sizeof(struct http_headers));
+						bzero(ret->headers,sizeof(struct http_headers));
 						ret->headers->uri_headers = kv;
 					}
 				}
@@ -178,7 +178,7 @@ static struct http_request* parse_http_request_1(struct http_request* ret, char*
 					if(body && body[0]) {
 						if(!ret->headers) {
 							ret->headers = (struct http_headers*)malloc(sizeof(struct http_headers));
-							ns_bzero(ret->headers,sizeof(struct http_headers));
+							bzero(ret->headers,sizeof(struct http_headers));
 						}
 						ret->headers->post_headers = post_parse(body,strlen(body));
 					}
@@ -199,7 +199,7 @@ struct http_request* parse_http_request(char* request) {
 	if(request) {
 
 		ret = (struct http_request*)malloc(sizeof(struct http_request));
-		ns_bzero(ret,sizeof(struct http_request));
+		bzero(ret,sizeof(struct http_request));
 
 		if(strstr(request,"GET ") == request) {
 			ret->rtype = HRT_GET;
@@ -318,7 +318,7 @@ struct str_buffer {
 struct str_buffer* str_buffer_new(void)
 {
 	struct str_buffer* ret = (struct str_buffer*)malloc(sizeof(struct str_buffer));
-	ns_bzero(ret,sizeof(struct str_buffer));
+	bzero(ret,sizeof(struct str_buffer));
 	ret->buffer = (char*)malloc(1);
 	ret->buffer[0] = 0;
 	ret->capacity = 1;
@@ -333,7 +333,7 @@ void str_buffer_append(struct str_buffer* sb, const char* str)
 			sb->capacity += len + 1024;
 			sb->buffer = (char*)realloc(sb->buffer,sb->capacity);
 		}
-		ns_bcopy(str,sb->buffer+sb->sz,len+1);
+		bcopy(str,sb->buffer+sb->sz,len+1);
 		sb->sz += len;
 	}
 }

+ 1 - 1
src/apps/relay/mainrelay.c

@@ -2153,7 +2153,7 @@ int main(int argc, char **argv)
 
 #endif
 
-	ns_bzero(&turn_params.default_users_db,sizeof(default_users_db_t));
+	bzero(&turn_params.default_users_db,sizeof(default_users_db_t));
 	turn_params.default_users_db.ram_db.static_accounts = ur_string_map_create(free);
 
 	if(strstr(argv[0],"turnadmin"))

+ 7 - 7
src/apps/relay/netengine.c

@@ -464,7 +464,7 @@ static void auth_server_receive_message(struct bufferevent *bev, void *ptr)
       if(get_user_key(am.in_oauth,&(am.out_oauth),&(am.max_session_time),am.username,am.realm,key,am.in_buffer.nbh)<0) {
     	  am.success = 0;
       } else {
-    	  ns_bcopy(key,am.key,sizeof(hmackey_t));
+    	  bcopy(key,am.key,sizeof(hmackey_t));
     	  am.success = 1;
       }
     }
@@ -567,7 +567,7 @@ static int send_socket_to_relay(turnserver_id id, u64bits cid, stun_tid *tid, io
 	int ret = -1;
 
 	struct message_to_relay sm;
-	ns_bzero(&sm,sizeof(struct message_to_relay));
+	bzero(&sm,sizeof(struct message_to_relay));
 	sm.t = rmt;
 
 	ioa_socket_handle s_to_delete = s;
@@ -698,7 +698,7 @@ int send_session_cancellation_to_relay(turnsession_id sid)
 	int ret = 0;
 
 	struct message_to_relay sm;
-	ns_bzero(&sm,sizeof(struct message_to_relay));
+	bzero(&sm,sizeof(struct message_to_relay));
 	sm.t = RMT_CANCEL_SESSION;
 
 	turnserver_id id = (turnserver_id)(sid / TURN_SESSION_ID_FACTOR);
@@ -914,7 +914,7 @@ static int send_message_from_listener_to_client(ioa_engine_handle e, ioa_network
 	addr_cpy(&(mm.m.tc.destination),destination);
 	mm.m.tc.nbh = ioa_network_buffer_allocate(e);
 	ioa_network_buffer_header_init(mm.m.tc.nbh);
-	ns_bcopy(ioa_network_buffer_data(nbh),ioa_network_buffer_data(mm.m.tc.nbh),ioa_network_buffer_get_size(nbh));
+	bcopy(ioa_network_buffer_data(nbh),ioa_network_buffer_data(mm.m.tc.nbh),ioa_network_buffer_get_size(nbh));
 	ioa_network_buffer_set_size(mm.m.tc.nbh,ioa_network_buffer_get_size(nbh));
 
 	struct evbuffer *output = bufferevent_get_output(turn_params.listener.out_buf);
@@ -1757,7 +1757,7 @@ static void* run_auth_server_thread(void *arg)
 
 	} else {
 
-		ns_bzero(as,sizeof(struct auth_server));
+		bzero(as,sizeof(struct auth_server));
 
 		as->id = id;
 
@@ -1815,7 +1815,7 @@ static void* run_admin_server_thread(void *arg)
 
 static void setup_admin_server(void)
 {
-	ns_bzero(&adminserver,sizeof(struct admin_server));
+	bzero(&adminserver,sizeof(struct admin_server));
 	adminserver.listen_fd = -1;
 	adminserver.verbose = turn_params.verbose;
 
@@ -1900,7 +1900,7 @@ void setup_server(void)
 
 void init_listener(void)
 {
-	ns_bzero(&turn_params.listener,sizeof(struct listener_server));
+	bzero(&turn_params.listener,sizeof(struct listener_server));
 }
 
 ///////////////////////////////

+ 13 - 13
src/apps/relay/ns_ioalib_engine_impl.c

@@ -313,7 +313,7 @@ static void add_buffer_to_buffer_list(stun_buffer_list *bufs, s08bits *buf, size
 {
 	if(bufs && buf && (bufs->tsz<MAX_SOCKET_BUFFER_BACKLOG)) {
 	  stun_buffer_list_elem *buf_elem = (stun_buffer_list_elem *)malloc(sizeof(stun_buffer_list_elem));
-	  ns_bcopy(buf,buf_elem->buf.buf,len);
+	  bcopy(buf,buf_elem->buf.buf,len);
 	  buf_elem->buf.len = len;
 	  buf_elem->buf.offset = 0;
 	  buf_elem->buf.coffset = 0;
@@ -410,7 +410,7 @@ ioa_engine_handle create_ioa_engine(super_memory_t *sm,
 					TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR,"FATAL: cannot create preferable timeval for %d secs (%d number)\n",predef_timer_intervals[t],t);
 					exit(-1);
 				} else {
-					ns_bcopy(ptv,&(e->predef_timers[t]),sizeof(struct timeval));
+					bcopy(ptv,&(e->predef_timers[t]),sizeof(struct timeval));
 					e->predef_timer_intervals[t] = predef_timer_intervals[t];
 				}
 			}
@@ -904,7 +904,7 @@ ioa_socket_handle create_unbound_relay_ioa_socket(ioa_engine_handle e, int famil
 	}
 
 	ret = (ioa_socket*)malloc(sizeof(ioa_socket));
-	ns_bzero(ret,sizeof(ioa_socket));
+	bzero(ret,sizeof(ioa_socket));
 
 	ret->magic = SOCKET_MAGIC;
 
@@ -1129,7 +1129,7 @@ static void tcp_listener_input_handler(struct evconnlistener *l, evutil_socket_t
 	ioa_socket_handle list_s = (ioa_socket_handle) arg;
 
 	ioa_addr client_addr;
-	ns_bcopy(sa,&client_addr,socklen);
+	bcopy(sa,&client_addr,socklen);
 
 	addr_debug_print(((list_s->e) && list_s->e->verbose), &client_addr,"tcp accepted from");
 
@@ -1349,7 +1349,7 @@ ioa_socket_handle create_ioa_socket_from_fd(ioa_engine_handle e,
 	}
 
 	ret = (ioa_socket*)malloc(sizeof(ioa_socket));
-	ns_bzero(ret,sizeof(ioa_socket));
+	bzero(ret,sizeof(ioa_socket));
 
 	ret->magic = SOCKET_MAGIC;
 
@@ -1621,7 +1621,7 @@ ioa_socket_handle detach_ioa_socket(ioa_socket_handle s)
 			return ret;
 		}
 
-		ns_bzero(ret,sizeof(ioa_socket));
+		bzero(ret,sizeof(ioa_socket));
 
 		ret->magic = SOCKET_MAGIC;
 
@@ -2466,7 +2466,7 @@ static int socket_input_worker(ioa_socket_handle s)
 			if(s->read_cb) {
 				ioa_net_data nd;
 
-				ns_bzero(&nd,sizeof(ioa_net_data));
+				bzero(&nd,sizeof(ioa_net_data));
 				addr_cpy(&(nd.src_addr),&remote_addr);
 				nd.nbh = buf_elem;
 				nd.recv_ttl = ttl;
@@ -3658,11 +3658,11 @@ struct _super_memory {
 static void init_super_memory_region(super_memory_t *r)
 {
 	if(r) {
-		ns_bzero(r,sizeof(super_memory_t));
+		bzero(r,sizeof(super_memory_t));
 
 		r->super_memory = (char**)malloc(sizeof(char*));
 		r->super_memory[0] = (char*)malloc(TURN_SM_SIZE);
-		ns_bzero(r->super_memory[0],TURN_SM_SIZE);
+		bzero(r->super_memory[0],TURN_SM_SIZE);
 
 		r->sm_allocated = (size_t*)malloc(sizeof(size_t*));
 		r->sm_allocated[0] = 0;
@@ -3699,7 +3699,7 @@ void* allocate_super_memory_region_func(super_memory_t *r, size_t size, const ch
 
 	if(!r) {
 		ret = malloc(size);
-		ns_bzero(ret, size);
+		bzero(ret, size);
 		return ret;
 	}
 
@@ -3733,7 +3733,7 @@ void* allocate_super_memory_region_func(super_memory_t *r, size_t size, const ch
 			r->sm_chunk += 1;
 			r->super_memory = (char**)realloc(r->super_memory,(r->sm_chunk+1) * sizeof(char*));
 			r->super_memory[r->sm_chunk] = (char*)malloc(TURN_SM_SIZE);
-			ns_bzero(r->super_memory[r->sm_chunk],TURN_SM_SIZE);
+			bzero(r->super_memory[r->sm_chunk],TURN_SM_SIZE);
 			r->sm_allocated = (size_t*)realloc(r->sm_allocated,(r->sm_chunk+1) * sizeof(size_t*));
 			r->sm_allocated[r->sm_chunk] = 0;
 			region = r->super_memory[r->sm_chunk];
@@ -3743,7 +3743,7 @@ void* allocate_super_memory_region_func(super_memory_t *r, size_t size, const ch
 		{
 			char* ptr = region + *rsz;
 
-			ns_bzero(ptr, size);
+			bzero(ptr, size);
 
 			*rsz += size;
 
@@ -3755,7 +3755,7 @@ void* allocate_super_memory_region_func(super_memory_t *r, size_t size, const ch
 
 	if(!ret) {
 		ret = malloc(size);
-		ns_bzero(ret, size);
+		bzero(ret, size);
 	}
 
 	return ret;

+ 2 - 2
src/apps/relay/tls_listener.c

@@ -76,7 +76,7 @@ static void server_input_handler(struct evconnlistener *l, evutil_socket_t fd,
 	if (!server)
 		return;
 
-	ns_bcopy(sa,&(server->sm.m.sm.nd.src_addr),socklen);
+	bcopy(sa,&(server->sm.m.sm.nd.src_addr),socklen);
 
 	addr_debug_print(server->verbose, &(server->sm.m.sm.nd.src_addr),"tcp or tls connected to");
 
@@ -141,7 +141,7 @@ static void sctp_server_input_handler(struct evconnlistener *l, evutil_socket_t
 	if (!server)
 		return;
 
-	ns_bcopy(sa,&(server->sm.m.sm.nd.src_addr),socklen);
+	bcopy(sa,&(server->sm.m.sm.nd.src_addr),socklen);
 
 	addr_debug_print(server->verbose, &(server->sm.m.sm.nd.src_addr),"sctp or tls/sctp connected to");
 

+ 6 - 6
src/apps/relay/turn_admin_server.c

@@ -934,7 +934,7 @@ static int run_cli_input(struct cli_session* cs, const char *buf0, unsigned int
 	if(cs && buf0 && cs->ts && cs->bev) {
 
 		char *buf = (char*)malloc(len+1);
-		ns_bcopy(buf0,buf,len);
+		bcopy(buf0,buf,len);
 		buf[len]=0;
 
 		char *cmd = buf;
@@ -1156,7 +1156,7 @@ static void cliserver_input_handler(struct evconnlistener *l, evutil_socket_t fd
 	addr_debug_print(adminserver.verbose, (ioa_addr*)sa,"CLI connected to");
 
 	struct cli_session *clisession = (struct cli_session*)malloc(sizeof(struct cli_session));
-	ns_bzero(clisession,sizeof(struct cli_session));
+	bzero(clisession,sizeof(struct cli_session));
 
 	clisession->rp = get_realm(NULL);
 
@@ -3012,7 +3012,7 @@ static void write_https_oauth_show_keys(ioa_socket_handle s, const char* kid)
 					} else {
 
 						oauth_key_data okd;
-						ns_bzero(&okd,sizeof(okd));
+						bzero(&okd,sizeof(okd));
 
 						convert_oauth_key_data_raw(&key, &okd);
 
@@ -3020,7 +3020,7 @@ static void write_https_oauth_show_keys(ioa_socket_handle s, const char* kid)
 						size_t err_msg_size = sizeof(err_msg) - 1;
 
 						oauth_key okey;
-						ns_bzero(&okey,sizeof(okey));
+						bzero(&okey,sizeof(okey));
 
 						if (convert_oauth_key_data(&okd, &okey, err_msg, err_msg_size) < 0) {
 							str_buffer_append(sb,err_msg);
@@ -3288,7 +3288,7 @@ static void handle_logon_request(ioa_socket_handle s, struct http_request* hr)
 		struct admin_session* as = (struct admin_session*)s->special_session;
 		if(!as) {
 			as = (struct admin_session*)malloc(sizeof(struct admin_session));
-			ns_bzero(as,sizeof(struct admin_session));
+			bzero(as,sizeof(struct admin_session));
 			s->special_session = as;
 			s->special_session_size = sizeof(struct admin_session);
 		}
@@ -3685,7 +3685,7 @@ static void handle_https(ioa_socket_handle s, ioa_network_buffer_handle nbh)
 							msg = "You must enter the key value.";
 						} else {
 							oauth_key_data_raw key;
-							ns_bzero(&key,sizeof(key));
+							bzero(&key,sizeof(key));
 							STRCPY(key.kid,add_kid);
 
 							if(add_lt && add_lt[0]) {

+ 17 - 17
src/apps/relay/userdb.c

@@ -117,7 +117,7 @@ void get_default_realm_options(realm_options_t* ro)
 {
 	if(ro) {
 		lock_realms();
-		ns_bcopy(&(default_realm_params_ptr->options),ro,sizeof(realm_options_t));
+		bcopy(&(default_realm_params_ptr->options),ro,sizeof(realm_options_t));
 		unlock_realms();
 	}
 }
@@ -142,7 +142,7 @@ realm_params_t* get_realm(char* name)
 			return (realm_params_t*)value;
 		} else {
 			realm_params_t *ret = (realm_params_t*)malloc(sizeof(realm_params_t));
-			ns_bcopy(default_realm_params_ptr,ret,sizeof(realm_params_t));
+			bcopy(default_realm_params_ptr,ret,sizeof(realm_params_t));
 			STRCPY(ret->options.name,name);
 			value = (ur_string_map_value_type)ret;
 			ur_string_map_put(realms, key, value);
@@ -159,7 +159,7 @@ realm_params_t* get_realm(char* name)
 int get_realm_data(char* name, realm_params_t* rp)
 {
 	lock_realms();
-	ns_bcopy(get_realm(name),rp,sizeof(realm_params_t));
+	bcopy(get_realm(name),rp,sizeof(realm_params_t));
 	unlock_realms();
 	return 0;
 }
@@ -173,7 +173,7 @@ int get_realm_options_by_origin(char *origin, realm_options_t* ro)
 		TURN_MUTEX_UNLOCK(&o_to_realm_mutex);
 		realm_params_t rp;
 		get_realm_data(realm, &rp);
-		ns_bcopy(&(rp.options),ro,sizeof(realm_options_t));
+		bcopy(&(rp.options),ro,sizeof(realm_options_t));
 		free(realm);
 		return 1;
 	} else {
@@ -187,7 +187,7 @@ void get_realm_options_by_name(char *realm, realm_options_t* ro)
 {
 	realm_params_t rp;
 	get_realm_data(realm, &rp);
-	ns_bcopy(&(rp.options),ro,sizeof(realm_options_t));
+	bcopy(&(rp.options),ro,sizeof(realm_options_t));
 }
 
 int change_total_quota(char *realm, int value)
@@ -251,7 +251,7 @@ static void must_set_admin_origin(void *origin0)
 void init_secrets_list(secrets_list_t *sl)
 {
 	if(sl) {
-		ns_bzero(sl,sizeof(secrets_list_t));
+		bzero(sl,sizeof(secrets_list_t));
 	}
 }
 
@@ -424,7 +424,7 @@ int get_user_key(int in_oauth, int *out_oauth, int *max_session_time, u08bits *u
 				if (dbd && dbd->get_oauth_key) {
 
 					oauth_key_data_raw rawKey;
-					ns_bzero(&rawKey,sizeof(rawKey));
+					bzero(&rawKey,sizeof(rawKey));
 
 					int gres = (*(dbd->get_oauth_key))(usname,&rawKey);
 					if(gres<0)
@@ -440,7 +440,7 @@ int get_user_key(int in_oauth, int *out_oauth, int *max_session_time, u08bits *u
 					}
 
 					oauth_key_data okd;
-					ns_bzero(&okd,sizeof(okd));
+					bzero(&okd,sizeof(okd));
 
 					convert_oauth_key_data_raw(&rawKey, &okd);
 
@@ -448,7 +448,7 @@ int get_user_key(int in_oauth, int *out_oauth, int *max_session_time, u08bits *u
 					size_t err_msg_size = sizeof(err_msg) - 1;
 
 					oauth_key okey;
-					ns_bzero(&okey,sizeof(okey));
+					bzero(&okey,sizeof(okey));
 
 					if (convert_oauth_key_data(&okd, &okey, err_msg, err_msg_size) < 0) {
 						TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s\n", err_msg);
@@ -456,16 +456,16 @@ int get_user_key(int in_oauth, int *out_oauth, int *max_session_time, u08bits *u
 					}
 
 					oauth_token dot;
-					ns_bzero((&dot),sizeof(dot));
+					bzero((&dot),sizeof(dot));
 
 					encoded_oauth_token etoken;
-					ns_bzero(&etoken,sizeof(etoken));
+					bzero(&etoken,sizeof(etoken));
 
 					if((size_t)len > sizeof(etoken.token)) {
 						TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Encoded oAuth token is too large\n");
 						return -1;
 					}
-					ns_bcopy(value,etoken.token,(size_t)len);
+					bcopy(value,etoken.token,(size_t)len);
 					etoken.size = (size_t)len;
 
 					const char* server_name = (char*)turn_params.oauth_server_name;
@@ -515,10 +515,10 @@ int get_user_key(int in_oauth, int *out_oauth, int *max_session_time, u08bits *u
 							}
 						}
 
-						ns_bcopy(dot.enc_block.mac_key,key,dot.enc_block.key_length);
+						bcopy(dot.enc_block.mac_key,key,dot.enc_block.key_length);
 
 						if(rawKey.realm[0]) {
-							ns_bcopy(rawKey.realm,realm,sizeof(rawKey.realm));
+							bcopy(rawKey.realm,realm,sizeof(rawKey.realm));
 						}
 
 						ret = 0;
@@ -622,7 +622,7 @@ int get_user_key(int in_oauth, int *out_oauth, int *max_session_time, u08bits *u
 
 	if(ret==0) {
 		size_t sz = get_hmackey_size(SHATYPE_DEFAULT);
-		ns_bcopy(ukey,key,sz);
+		bcopy(ukey,key,sz);
 		return 0;
 	}
 
@@ -639,7 +639,7 @@ u08bits *start_user_check(turnserver_id id, turn_credential_type ct, int in_oaut
 	*postpone_reply = 1;
 
 	struct auth_message am;
-	ns_bzero(&am,sizeof(struct auth_message));
+	bzero(&am,sizeof(struct auth_message));
 	am.id = id;
 	am.ct = ct;
 	am.in_oauth = in_oauth;
@@ -1164,7 +1164,7 @@ const ip_range_list_t* ioa_get_blacklist(ioa_engine_handle e)
 ip_range_list_t* get_ip_list(const char *kind)
 {
 	ip_range_list_t *ret = (ip_range_list_t*) malloc(sizeof(ip_range_list_t));
-	ns_bzero(ret,sizeof(ip_range_list_t));
+	bzero(ret,sizeof(ip_range_list_t));
 
 	const turn_dbdriver_t * dbd = get_dbdriver();
 	if (dbd && dbd->get_ip_list) {

+ 6 - 6
src/apps/rfc5769/rfc5769check.c

@@ -96,24 +96,24 @@ static int check_oauth(void) {
 					printf("\n");
 
 				oauth_token ot;
-				ns_bzero(&ot,sizeof(ot));
+				bzero(&ot,sizeof(ot));
 				ot.enc_block.key_length = (uint16_t)mac_key_length;
 				STRCPY(ot.enc_block.mac_key,mac_key);
 				ot.enc_block.timestamp = token_timestamp;
 				ot.enc_block.lifetime = token_lifetime;
 
 				oauth_token dot;
-				ns_bzero((&dot),sizeof(dot));
+				bzero((&dot),sizeof(dot));
 				oauth_key key;
-				ns_bzero(&key,sizeof(key));
+				bzero(&key,sizeof(key));
 
 				{
 					oauth_key_data okd;
-					ns_bzero(&okd,sizeof(okd));
+					bzero(&okd,sizeof(okd));
 
 					{
 					  oauth_key_data_raw okdr;
-					  ns_bzero(&okdr,sizeof(okdr));
+					  bzero(&okdr,sizeof(okdr));
 
 						STRCPY(okdr.kid,kid);
 						STRCPY(okdr.ikm_key,base64encoded_ltp);
@@ -141,7 +141,7 @@ static int check_oauth(void) {
 
 				{
 					encoded_oauth_token etoken;
-					ns_bzero(&etoken,sizeof(etoken));
+					bzero(&etoken,sizeof(etoken));
 
 					if (encode_oauth_token((const u08bits *) server_name, &etoken,
 							&key, &ot, (const u08bits*)gcm_nonce) < 0) {

+ 2 - 2
src/apps/stunclient/stunclient.c

@@ -253,7 +253,7 @@ static int run_stunclient(const char* rip, int rport, int *port, int *rfc5780, i
 	int new_udp_fd = -1;
 	stun_buffer buf;
 
-	ns_bzero(&remote_addr, sizeof(remote_addr));
+	bzero(&remote_addr, sizeof(remote_addr));
 	if (make_ioa_addr((const u08bits*) rip, rport, &remote_addr) < 0)
 		err(-1, NULL);
 
@@ -418,7 +418,7 @@ int main(int argc, char **argv)
   set_logfile("stdout");
   set_system_parameters(0);
   
-  ns_bzero(local_addr, sizeof(local_addr));
+  bzero(local_addr, sizeof(local_addr));
 
   while ((c = getopt(argc, argv, "p:L:f")) != -1) {
     switch(c) {

+ 2 - 2
src/apps/uclient/mainuclient.c

@@ -179,7 +179,7 @@ int main(int argc, char **argv)
 
 	set_system_parameters(0);
 
-	ns_bzero(local_addr, sizeof(local_addr));
+	bzero(local_addr, sizeof(local_addr));
 
 	while ((c = getopt(argc, argv, "a:d:p:l:n:L:m:e:r:u:w:i:k:z:W:C:E:F:o:bZvsyhcxXgtTSAPDNOUMRIGBJ")) != -1) {
 		switch (c){
@@ -414,7 +414,7 @@ int main(int argc, char **argv)
 
 				if(pwd) {
 					if(pwd_length>0) {
-						ns_bcopy(pwd,g_upwd,pwd_length);
+						bcopy(pwd,g_upwd,pwd_length);
 						g_upwd[pwd_length]=0;
 					}
 				}

+ 5 - 5
src/apps/uclient/startuclient.c

@@ -222,12 +222,12 @@ static int clnet_connect(uint16_t clnet_remote_port, const char *remote_address,
 	clnet_fd = -1;
 	connect_err = 0;
 
-	ns_bzero(&remote_addr, sizeof(ioa_addr));
+	bzero(&remote_addr, sizeof(ioa_addr));
 	if (make_ioa_addr((const u08bits*) remote_address, clnet_remote_port,
 			&remote_addr) < 0)
 		return -1;
 
-	ns_bzero(&local_addr, sizeof(ioa_addr));
+	bzero(&local_addr, sizeof(ioa_addr));
 
 	clnet_fd = socket(remote_addr.ss.sa_family,
 			use_sctp ? SCTP_CLIENT_STREAM_SOCKET_TYPE : (use_tcp ? CLIENT_STREAM_SOCKET_TYPE : CLIENT_DGRAM_SOCKET_TYPE),
@@ -317,7 +317,7 @@ int read_mobility_ticket(app_ur_conn_info *clnet_info, stun_buffer *message)
 			if(smid_len>0 && (((size_t)smid_len)<sizeof(clnet_info->s_mobile_id))) {
 				const u08bits* smid_val = stun_attr_get_value(s_mobile_id_sar);
 				if(smid_val) {
-					ns_bcopy(smid_val, clnet_info->s_mobile_id, (size_t)smid_len);
+					bcopy(smid_val, clnet_info->s_mobile_id, (size_t)smid_len);
 					clnet_info->s_mobile_id[smid_len] = 0;
 					if (clnet_verbose)
 						TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO,
@@ -610,7 +610,7 @@ static int clnet_allocate(int verbose,
 		  }
 
 		  app_ur_conn_info ci;
-		  ns_bcopy(clnet_info,&ci,sizeof(ci));
+		  bcopy(clnet_info,&ci,sizeof(ci));
 		  ci.fd = -1;
 		  ci.ssl = NULL;
 		  clnet_info->fd = -1;
@@ -1538,7 +1538,7 @@ void tcp_data_connect(app_ur_session *elem, u32bits cid)
 	int i = (int)(elem->pinfo.tcp_conn_number-1);
 	elem->pinfo.tcp_conn=(app_tcp_conn_info**)realloc(elem->pinfo.tcp_conn,elem->pinfo.tcp_conn_number*sizeof(app_tcp_conn_info*));
 	elem->pinfo.tcp_conn[i]=(app_tcp_conn_info*)malloc(sizeof(app_tcp_conn_info));
-	ns_bzero(elem->pinfo.tcp_conn[i],sizeof(app_tcp_conn_info));
+	bzero(elem->pinfo.tcp_conn[i],sizeof(app_tcp_conn_info));
 
 	elem->pinfo.tcp_conn[i]->tcp_data_fd = clnet_fd;
 	elem->pinfo.tcp_conn[i]->cid = cid;

+ 7 - 7
src/apps/uclient/uclient.c

@@ -116,7 +116,7 @@ static int refresh_channel(app_ur_session* elem, u16bits method, uint32_t lt);
 
 static app_ur_session* init_app_session(app_ur_session *ss) {
   if(ss) {
-    ns_bzero(ss,sizeof(app_ur_session));
+    bzero(ss,sizeof(app_ur_session));
     ss->pinfo.fd=-1;
   }
   return ss;
@@ -678,7 +678,7 @@ static int client_read(app_ur_session *elem, int is_tcp_data, app_tcp_conn_info
 
 		if(is_tcp_data) {
 		  if ((int)elem->in_buffer.len == clmessage_length) {
-		    ns_bcopy((elem->in_buffer.buf), &mi, sizeof(message_info));
+		    bcopy((elem->in_buffer.buf), &mi, sizeof(message_info));
 		    miset=1;
 		  }
 		} else if (stun_is_indication(&(elem->in_buffer))) {
@@ -727,7 +727,7 @@ static int client_read(app_ur_session *elem, int is_tcp_data, app_tcp_conn_info
 
 				const u08bits* data = stun_attr_get_value(sar);
 
-				ns_bcopy(data, &mi, sizeof(message_info));
+				bcopy(data, &mi, sizeof(message_info));
 				miset=1;
 			}
 
@@ -783,7 +783,7 @@ static int client_read(app_ur_session *elem, int is_tcp_data, app_tcp_conn_info
 					return rc;
 				}
 
-				ns_bcopy(elem->in_buffer.buf + 4, &mi, sizeof(message_info));
+				bcopy(elem->in_buffer.buf + 4, &mi, sizeof(message_info));
 				miset=1;
 				applen = elem->in_buffer.len -4;
 			}
@@ -1002,7 +1002,7 @@ static int start_client(const char *remote_address, int port,
     ss_rtcp = create_new_ss();
 
   app_ur_conn_info clnet_info_probe; /* for load balancing probe */
-  ns_bzero(&clnet_info_probe,sizeof(clnet_info_probe));
+  bzero(&clnet_info_probe,sizeof(clnet_info_probe));
   clnet_info_probe.fd = -1;
 
   app_ur_conn_info *clnet_info=&(ss->pinfo);
@@ -1096,7 +1096,7 @@ static int start_c2c(const char *remote_address, int port,
     ss2_rtcp = create_new_ss();
 
   app_ur_conn_info clnet_info_probe; /* for load balancing probe */
-  ns_bzero(&clnet_info_probe,sizeof(clnet_info_probe));
+  bzero(&clnet_info_probe,sizeof(clnet_info_probe));
   clnet_info_probe.fd = -1;
 
   app_ur_conn_info *clnet_info1=&(ss1->pinfo);
@@ -1641,7 +1641,7 @@ int add_integrity(app_ur_conn_info *clnet_info, stun_buffer *message)
 				stun_attr_add_str(message->buf, (size_t*)&(message->len), STUN_ATTRIBUTE_OAUTH_ACCESS_TOKEN,
 					(const u08bits*)etoken.token, (int)etoken.size);
 
-				ns_bcopy(otoken.enc_block.mac_key,clnet_info->key,otoken.enc_block.key_length);
+				bcopy(otoken.enc_block.mac_key,clnet_info->key,otoken.enc_block.key_length);
 				clnet_info->key_set = 1;
 			}
 

+ 2 - 2
src/client++/TurnMsgLib.h

@@ -211,7 +211,7 @@ public:
 		_sz = sz;
 		_value=(u08bits*)malloc(_sz);
 		if(ptr)
-			ns_bcopy(ptr,_value,_sz);
+			bcopy(ptr,_value,_sz);
 	}
 
 	/**
@@ -241,7 +241,7 @@ public:
 		_sz = sz;
 		_value=(u08bits*)malloc(_sz);
 		if(value)
-			ns_bcopy(value,_value,_sz);
+			bcopy(value,_value,_sz);
 	}
 
 	/**

+ 9 - 9
src/client/ns_turn_ioaddr.c

@@ -44,7 +44,7 @@ u32bits get_ioa_addr_len(const ioa_addr* addr) {
 
 void addr_set_any(ioa_addr *addr) {
 	if(addr)
-		ns_bzero(addr,sizeof(ioa_addr));
+		bzero(addr,sizeof(ioa_addr));
 }
 
 int addr_any(const ioa_addr* addr) {
@@ -107,7 +107,7 @@ u32bits addr_hash(const ioa_addr *addr)
 		ret = hash_int32(addr->s4.sin_addr.s_addr + addr->s4.sin_port);
 	} else {
 		u64bits a[2];
-		ns_bcopy(&(addr->s6.sin6_addr), &a, sizeof(a));
+		bcopy(&(addr->s6.sin6_addr), &a, sizeof(a));
 		ret = (u32bits)((hash_int64(a[0])<<3) + (hash_int64(a[1] + addr->s6.sin6_port)));
 	}
 	return ret;
@@ -123,7 +123,7 @@ u32bits addr_hash_no_port(const ioa_addr *addr)
 		ret = hash_int32(addr->s4.sin_addr.s_addr);
 	} else {
 		u64bits a[2];
-		ns_bcopy(&(addr->s6.sin6_addr), &a, sizeof(a));
+		bcopy(&(addr->s6.sin6_addr), &a, sizeof(a));
 		ret = (u32bits)((hash_int64(a[0])<<3) + (hash_int64(a[1])));
 	}
 	return ret;
@@ -131,17 +131,17 @@ u32bits addr_hash_no_port(const ioa_addr *addr)
 
 void addr_cpy(ioa_addr* dst, const ioa_addr* src) {
 	if(dst && src)
-		ns_bcopy(src,dst,sizeof(ioa_addr));
+		bcopy(src,dst,sizeof(ioa_addr));
 }
 
 void addr_cpy4(ioa_addr* dst, const struct sockaddr_in* src) {
 	if(src && dst)
-		ns_bcopy(src,dst,sizeof(struct sockaddr_in));
+		bcopy(src,dst,sizeof(struct sockaddr_in));
 }
 
 void addr_cpy6(ioa_addr* dst, const struct sockaddr_in6* src) {
 	if(src && dst)
-		ns_bcopy(src,dst,sizeof(struct sockaddr_in6));
+		bcopy(src,dst,sizeof(struct sockaddr_in6));
 }
 
 int addr_eq(const ioa_addr* a1, const ioa_addr *a2) {
@@ -203,7 +203,7 @@ int make_ioa_addr(const u08bits* saddr0, int port, ioa_addr *addr) {
 	  }
   }
 
-  ns_bzero(addr, sizeof(ioa_addr));
+  bzero(addr, sizeof(ioa_addr));
   if((len == 0)||
      (inet_pton(AF_INET, saddr, &addr->s4.sin_addr) == 1)) {
     addr->s4.sin_family = AF_INET;
@@ -247,7 +247,7 @@ int make_ioa_addr(const u08bits* saddr0, int port, ioa_addr *addr) {
 
     	if(addr_result->ai_family == family) {
     		if (addr_result->ai_family == AF_INET) {
-    			ns_bcopy(addr_result->ai_addr, addr, addr_result->ai_addrlen);
+    			bcopy(addr_result->ai_addr, addr, addr_result->ai_addrlen);
     			addr->s4.sin_port = nswap16(port);
 #if defined(TURN_HAS_SIN_LEN) /* tested when configured */
     			addr->s4.sin_len = sizeof(struct sockaddr_in);
@@ -255,7 +255,7 @@ int make_ioa_addr(const u08bits* saddr0, int port, ioa_addr *addr) {
     			found = 1;
     			break;
     		} else if (addr_result->ai_family == AF_INET6) {
-    			ns_bcopy(addr_result->ai_addr, addr, addr_result->ai_addrlen);
+    			bcopy(addr_result->ai_addr, addr, addr_result->ai_addrlen);
     			addr->s6.sin6_port = nswap16(port);
 #if defined(SIN6_LEN) /* this define is required by IPv6 if used */
     			addr->s6.sin6_len = sizeof(struct sockaddr_in6);

+ 39 - 39
src/client/ns_turn_msg.c

@@ -87,7 +87,7 @@ int stun_method_str(u16bits method, char *smethod)
 	};
 
 	if(smethod) {
-		ns_bcopy(s,smethod,strlen(s)+1);
+		bcopy(s,smethod,strlen(s)+1);
 	}
 
 	return ret;
@@ -264,7 +264,7 @@ static void generate_enc_password(const char* pwd, char *result, const unsigned
 	if(!orig_salt) {
 		generate_random_nonce(salt, PWD_SALT_SIZE);
 	} else {
-		ns_bcopy(orig_salt,salt,PWD_SALT_SIZE);
+		bcopy(orig_salt,salt,PWD_SALT_SIZE);
 		salt[PWD_SALT_SIZE]=0;
 	}
 	unsigned char rsalt[PWD_SALT_SIZE*2+1];
@@ -272,7 +272,7 @@ static void generate_enc_password(const char* pwd, char *result, const unsigned
 	result[0]='$';
 	result[1]='5';
 	result[2]='$';
-	ns_bcopy((char*)rsalt,result+3,PWD_SALT_SIZE+PWD_SALT_SIZE);
+	bcopy((char*)rsalt,result+3,PWD_SALT_SIZE+PWD_SALT_SIZE);
 	result[3+PWD_SALT_SIZE+PWD_SALT_SIZE]='$';
 	unsigned char* out = (unsigned char*)(result+3+PWD_SALT_SIZE+PWD_SALT_SIZE+1);
 	{
@@ -491,7 +491,7 @@ int stun_is_error_response_str(const u08bits* buf, size_t len, int *err_code, u0
     				  size_t msg_len = stun_attr_get_len(sar) - 4;
     				  if(msg_len>(err_msg_size-1))
     					  msg_len=err_msg_size - 1;
-    				  ns_bcopy(val+4, err_msg, msg_len);
+    				  bcopy(val+4, err_msg, msg_len);
     				  err_msg[msg_len]=0;
     			  }
     		  }
@@ -518,7 +518,7 @@ int stun_is_challenge_response_str(const u08bits* buf, size_t len, int *err_code
 			const u08bits *value = stun_attr_get_value(sar);
 			if(value) {
 				size_t vlen = (size_t)stun_attr_get_len(sar);
-				ns_bcopy(value,realm,vlen);
+				bcopy(value,realm,vlen);
 				realm[vlen]=0;
 
 				{
@@ -529,7 +529,7 @@ int stun_is_challenge_response_str(const u08bits* buf, size_t len, int *err_code
 							size_t vlen = (size_t)stun_attr_get_len(sar);
 							if(vlen>0) {
 								if(server_name) {
-									ns_bcopy(value,server_name,vlen);
+									bcopy(value,server_name,vlen);
 								}
 								found_oauth = 1;
 							}
@@ -542,7 +542,7 @@ int stun_is_challenge_response_str(const u08bits* buf, size_t len, int *err_code
 					value = stun_attr_get_value(sar);
 					if(value) {
 						vlen = (size_t)stun_attr_get_len(sar);
-						ns_bcopy(value,nonce,vlen);
+						bcopy(value,nonce,vlen);
 						nonce[vlen]=0;
 						if(oauth) {
 							*oauth = found_oauth;
@@ -589,7 +589,7 @@ u16bits stun_make_error_response(u16bits method) {
 
 void stun_init_buffer_str(u08bits *buf, size_t *len) {
   *len=STUN_HEADER_LENGTH;
-  ns_bzero(buf,*len);
+  bzero(buf,*len);
 }
 
 void stun_init_command_str(u16bits message_type, u08bits* buf, size_t *len) {
@@ -1079,7 +1079,7 @@ u16bits stun_set_channel_bind_request_str(u08bits* buf, size_t *len,
   
   if(!peer_addr) {
     ioa_addr ca;
-    ns_bzero(&ca,sizeof(ioa_addr));
+    bzero(&ca,sizeof(ioa_addr));
     
     if(stun_attr_add_addr_str(buf,len,STUN_ATTRIBUTE_XOR_PEER_ADDRESS, &ca)<0) return 0;
   } else {
@@ -1174,18 +1174,18 @@ int stun_tid_equals(const stun_tid *id1, const stun_tid *id2) {
 void stun_tid_cpy(stun_tid *id1, const stun_tid *id2) {
   if(!id1) return;
   if(!id2) return;
-  ns_bcopy((const void*)(id2->tsx_id),(void*)(id1->tsx_id),STUN_TID_SIZE);
+  bcopy((const void*)(id2->tsx_id),(void*)(id1->tsx_id),STUN_TID_SIZE);
 }
 
 static void stun_tid_string_cpy(u08bits* s, const stun_tid* id) {
   if(s && id) {
-    ns_bcopy((const void*)(id->tsx_id),s,STUN_TID_SIZE);
+    bcopy((const void*)(id->tsx_id),s,STUN_TID_SIZE);
   }
 }
 
 static void stun_tid_from_string(const u08bits* s, stun_tid* id) {
   if(s && id) {
-    ns_bcopy(s,(void*)(id->tsx_id),STUN_TID_SIZE);
+    bcopy(s,(void*)(id->tsx_id),STUN_TID_SIZE);
   }
 }
 
@@ -1297,7 +1297,7 @@ u64bits stun_attr_get_reservation_token_value(stun_attr_ref attr)  {
     const u08bits* value = stun_attr_get_value(attr);
     if(value && (stun_attr_get_len(attr) == 8)) {
       u64bits token;
-      ns_bcopy(value, &token, sizeof(u64bits));
+      bcopy(value, &token, sizeof(u64bits));
       return nswap64(token);
     }
   }
@@ -1400,7 +1400,7 @@ int stun_attr_add_str(u08bits* buf, size_t *len, u16bits attr, const u08bits* av
     
     attr_start_16t[0]=nswap16(attr);
     attr_start_16t[1]=nswap16(alen);
-    if(alen>0) ns_bcopy(avalue,attr_start+4,alen);
+    if(alen>0) bcopy(avalue,attr_start+4,alen);
     return 0;
   }
 }
@@ -1993,7 +1993,7 @@ int stun_attr_get_padding_len_str(stun_attr_ref attr) {
 int stun_attr_add_padding_str(u08bits *buf, size_t *len, u16bits padding_len)
 {
 	u08bits avalue[0xFFFF];
-	ns_bzero(avalue,padding_len);
+	bzero(avalue,padding_len);
 
 	return stun_attr_add_str(buf, len, STUN_ATTRIBUTE_PADDING, avalue, padding_len);
 }
@@ -2081,7 +2081,7 @@ int calculate_key(char *key, size_t key_size,
 {
 	UNUSED_ARG(key_size);
 
-	ns_bcopy(key,new_key,new_key_size);
+	bcopy(key,new_key,new_key_size);
 
 	return 0;
 }
@@ -2091,7 +2091,7 @@ int convert_oauth_key_data(const oauth_key_data *oakd0, oauth_key *key, char *er
 	if(oakd0 && key) {
 
 		oauth_key_data oakd_obj;
-		ns_bcopy(oakd0,&oakd_obj,sizeof(oauth_key_data));
+		bcopy(oakd0,&oakd_obj,sizeof(oauth_key_data));
 		oauth_key_data *oakd = &oakd_obj;
 
 		if(!(oakd->ikm_key_size)) {
@@ -2114,11 +2114,11 @@ int convert_oauth_key_data(const oauth_key_data *oakd0, oauth_key *key, char *er
 			return -1;
 		}
 
-		ns_bzero(key,sizeof(oauth_key));
+		bzero(key,sizeof(oauth_key));
 
 		STRCPY(key->kid,oakd->kid);
 
-		ns_bcopy(oakd->ikm_key,key->ikm_key,sizeof(key->ikm_key));
+		bcopy(oakd->ikm_key,key->ikm_key,sizeof(key->ikm_key));
 		key->ikm_key_size = oakd->ikm_key_size;
 
 		key->timestamp = oakd->timestamp;
@@ -2248,13 +2248,13 @@ int encode_oauth_token_normal(const u08bits *server_name, encoded_oauth_token *e
 	if(server_name && etoken && key && dtoken && (dtoken->enc_block.key_length<=128)) {
 
 		unsigned char orig_field[MAX_ENCODED_OAUTH_TOKEN_SIZE];
-		ns_bzero(orig_field,sizeof(orig_field));
+		bzero(orig_field,sizeof(orig_field));
 
 		size_t len = 0;
 		*((uint16_t*)(orig_field+len)) = nswap16(dtoken->enc_block.key_length);
 		len +=2;
 
-		ns_bcopy(dtoken->enc_block.mac_key,orig_field+len,dtoken->enc_block.key_length);
+		bcopy(dtoken->enc_block.mac_key,orig_field+len,dtoken->enc_block.key_length);
 		len += dtoken->enc_block.key_length;
 
 		*((uint64_t*)(orig_field+len)) = nswap64(dtoken->enc_block.timestamp);
@@ -2284,7 +2284,7 @@ int encode_oauth_token_normal(const u08bits *server_name, encoded_oauth_token *e
 		EVP_CIPHER_CTX_cleanup(&ctx);
 
 		size_t sn_len = strlen((const char*)server_name);
-		ns_bcopy(server_name,encoded_field+outl,sn_len);
+		bcopy(server_name,encoded_field+outl,sn_len);
 		outl += sn_len;
 
 		const EVP_MD *md = get_auth_type(key->auth_alg);
@@ -2298,7 +2298,7 @@ int encode_oauth_token_normal(const u08bits *server_name, encoded_oauth_token *e
 
 		update_hmac_len(key->auth_alg, &hmac_len);
 
-		ns_bcopy(encoded_field + outl, encoded_field + outl - sn_len, hmac_len);
+		bcopy(encoded_field + outl, encoded_field + outl - sn_len, hmac_len);
 		outl -= sn_len;
 		outl += hmac_len; //encoded+hmac
 
@@ -2344,14 +2344,14 @@ int decode_oauth_token_normal(const u08bits *server_name, const encoded_oauth_to
        		}
        		unsigned char efield[MAX_ENCODED_OAUTH_TOKEN_SIZE];
        		unsigned char check_mac[MAXSHASIZE];
-       		ns_bcopy(encoded_field,efield,encoded_field_size);
+       		bcopy(encoded_field,efield,encoded_field_size);
        		size_t sn_len = strlen((const char*)server_name);
-       		ns_bcopy(server_name,efield+encoded_field_size,sn_len);
+       		bcopy(server_name,efield+encoded_field_size,sn_len);
 		    if (!HMAC(md, key->auth_key, key->auth_key_size, efield, encoded_field_size+sn_len, check_mac, &hmac_len)) {
 		    	return -1;
 		    }
 
-		    if(ns_bcmp(check_mac,mac,mac_size)) {
+		    if(bcmp(check_mac,mac,mac_size)) {
 		    	OAUTH_ERROR("%s: token integrity check failed\n",__FUNCTION__);
 		    	return -1;
 		    }
@@ -2381,7 +2381,7 @@ int decode_oauth_token_normal(const u08bits *server_name, const encoded_oauth_to
 		dtoken->enc_block.key_length = nswap16(*((uint16_t*)(decoded_field+len)));
 		len += 2;
 
-		ns_bcopy(decoded_field+len,dtoken->enc_block.mac_key,dtoken->enc_block.key_length);
+		bcopy(decoded_field+len,dtoken->enc_block.mac_key,dtoken->enc_block.key_length);
 		len += dtoken->enc_block.key_length;
 
 		dtoken->enc_block.timestamp = nswap64(*((uint64_t*)(decoded_field+len)));
@@ -2411,11 +2411,11 @@ static int encode_oauth_token_gcm(const u08bits *server_name, encoded_oauth_toke
 	if(server_name && etoken && key && dtoken && (dtoken->enc_block.key_length<=MAXSHASIZE)) {
 
 		unsigned char orig_field[MAX_ENCODED_OAUTH_TOKEN_SIZE];
-		ns_bzero(orig_field,sizeof(orig_field));
+		bzero(orig_field,sizeof(orig_field));
 
 		unsigned char nonce[OAUTH_GCM_NONCE_SIZE];
 		if(nonce0) {
-			ns_bcopy(nonce0,nonce,sizeof(nonce));
+			bcopy(nonce0,nonce,sizeof(nonce));
 		} else {
 			generate_random_nonce(nonce, sizeof(nonce));
 		}
@@ -2425,17 +2425,17 @@ static int encode_oauth_token_gcm(const u08bits *server_name, encoded_oauth_toke
 		*((uint16_t*)(orig_field+len)) = nswap16(OAUTH_GCM_NONCE_SIZE);
 		len +=2;
 
-		ns_bcopy(nonce,orig_field+len,OAUTH_GCM_NONCE_SIZE);
+		bcopy(nonce,orig_field+len,OAUTH_GCM_NONCE_SIZE);
 		len += OAUTH_GCM_NONCE_SIZE;
 
 		*((uint16_t*)(orig_field+len)) = nswap16(dtoken->enc_block.key_length);
 		len +=2;
 
-		ns_bcopy(dtoken->enc_block.mac_key,orig_field+len,dtoken->enc_block.key_length);
+		bcopy(dtoken->enc_block.mac_key,orig_field+len,dtoken->enc_block.key_length);
 		len += dtoken->enc_block.key_length;
 
 		uint64_t ts = nswap64(dtoken->enc_block.timestamp);
-		ns_bcopy( &ts, (orig_field+len), sizeof(ts));
+		bcopy( &ts, (orig_field+len), sizeof(ts));
 		len += sizeof(ts);
 
 		*((uint32_t*)(orig_field+len)) = nswap32(dtoken->enc_block.lifetime);
@@ -2478,7 +2478,7 @@ static int encode_oauth_token_gcm(const u08bits *server_name, encoded_oauth_toke
 
 		outl=0;
 		unsigned char *encoded_field = (unsigned char*)etoken->token;
-		ns_bcopy(orig_field,encoded_field,OAUTH_GCM_NONCE_SIZE + 2);
+		bcopy(orig_field,encoded_field,OAUTH_GCM_NONCE_SIZE + 2);
 		encoded_field += OAUTH_GCM_NONCE_SIZE + 2;
 		unsigned char *start_field = orig_field + OAUTH_GCM_NONCE_SIZE + 2;
 		len -= OAUTH_GCM_NONCE_SIZE + 2;
@@ -2511,7 +2511,7 @@ static int decode_oauth_token_gcm(const u08bits *server_name, const encoded_oaut
 	if(server_name && etoken && key && dtoken) {
 
 		unsigned char snl[2];
-		ns_bcopy((const unsigned char*)(etoken->token),snl,2);
+		bcopy((const unsigned char*)(etoken->token),snl,2);
 		const unsigned char *csnl = snl;
 
 		uint16_t nonce_len = nswap16(*((const uint16_t*)csnl));
@@ -2526,10 +2526,10 @@ static int decode_oauth_token_gcm(const u08bits *server_name, const encoded_oaut
 		const unsigned char* encoded_field = (const unsigned char*)(etoken->token + nonce_len + 2);
 		unsigned int encoded_field_size = (unsigned int)etoken->size - nonce_len - 2 - OAUTH_GCM_TAG_SIZE;
 		const unsigned char* nonce = ((const unsigned char*)etoken->token + 2);
-                ns_bcopy(nonce,dtoken->enc_block.nonce,nonce_len);
+                bcopy(nonce,dtoken->enc_block.nonce,nonce_len);
 
 		unsigned char tag[OAUTH_GCM_TAG_SIZE];
-		ns_bcopy(((const unsigned char*)etoken->token) + nonce_len + 2 + encoded_field_size, tag ,sizeof(tag));
+		bcopy(((const unsigned char*)etoken->token) + nonce_len + 2 + encoded_field_size, tag ,sizeof(tag));
 
 		unsigned char decoded_field[MAX_ENCODED_OAUTH_TOKEN_SIZE];
 
@@ -2608,16 +2608,16 @@ static int decode_oauth_token_gcm(const u08bits *server_name, const encoded_oaut
 		dtoken->enc_block.key_length = nswap16(*((uint16_t*)(decoded_field+len)));
 		len += 2;
 
-		ns_bcopy(decoded_field+len,dtoken->enc_block.mac_key,dtoken->enc_block.key_length);
+		bcopy(decoded_field+len,dtoken->enc_block.mac_key,dtoken->enc_block.key_length);
 		len += dtoken->enc_block.key_length;
 
 		uint64_t ts;
-		ns_bcopy((decoded_field+len),&ts,sizeof(ts));
+		bcopy((decoded_field+len),&ts,sizeof(ts));
 		dtoken->enc_block.timestamp = nswap64(ts);
 		len += sizeof(ts);
 
 		uint32_t lt;
-		ns_bcopy((decoded_field+len),&lt,sizeof(lt));
+		bcopy((decoded_field+len),&lt,sizeof(lt));
 		dtoken->enc_block.lifetime = nswap32(lt);
 		len += sizeof(lt);
 

+ 2 - 2
src/client/ns_turn_msg_addr.c

@@ -96,7 +96,7 @@ int stun_addr_encode(const ioa_addr* ca, u08bits *cfield, int *clen, int xor_ed,
       ((u16bits*)cfield)[1]=ca->s6.sin6_port;
       
       /* Address */
-      ns_bcopy(&ca->s6.sin6_addr, ((u08bits*)cfield)+4, 16);
+      bcopy(&ca->s6.sin6_addr, ((u08bits*)cfield)+4, 16);
     }
 
   } else {
@@ -149,7 +149,7 @@ int stun_addr_decode(ioa_addr* ca, const u08bits *cfield, int len, int xor_ed, u
     ca->s6.sin6_port = ((const u16bits*)cfield)[1];
 
     /* Address */
-    ns_bcopy(((const u08bits*)cfield)+4, &ca->s6.sin6_addr, 16);
+    bcopy(((const u08bits*)cfield)+4, &ca->s6.sin6_addr, 16);
 
     if (xor_ed) {
 

+ 0 - 4
src/ns_turn_defs.h

@@ -72,10 +72,6 @@ extern "C" {
 #define	u32bits	uint32_t
 #define	u64bits	uint64_t
 
-#define ns_bcopy(src,dst,sz) bcopy((src),(dst),(sz))
-#define ns_bzero(ptr,sz) bzero((ptr),(sz))
-#define ns_bcmp(ptr1,ptr2,sz) bcmp((ptr1),(ptr2),(sz))
-
 #define nswap16(s) ntohs(s)
 #define nswap32(ul) ntohl(ul)
 #define nswap64(ull) ioa_ntoh64(ull)

+ 8 - 8
src/server/ns_turn_allocation.c

@@ -40,7 +40,7 @@ static turn_permission_info* get_from_turn_permission_hashtable(turn_permission_
 
 void init_allocation(void *owner, allocation* a, ur_map *tcp_connections) {
   if(a) {
-    ns_bzero(a,sizeof(allocation));
+    bzero(a,sizeof(allocation));
     a->owner = owner;
     a->tcp_connections = tcp_connections;
     init_turn_permission_hashtable(&(a->addr_to_perm));
@@ -185,14 +185,14 @@ void turn_permission_clean(turn_permission_info* tinfo)
 		IOA_EVENT_DEL(tinfo->lifetime_ev);
 		lm_map_foreach(&(tinfo->chns), (foreachcb_type) delete_channel_info_from_allocation_map);
 		lm_map_clean(&(tinfo->chns));
-		ns_bzero(tinfo,sizeof(turn_permission_info));
+		bzero(tinfo,sizeof(turn_permission_info));
 	}
 }
 
 static void init_turn_permission_hashtable(turn_permission_hashtable *map)
 {
 	if (map)
-		ns_bzero(map,sizeof(turn_permission_hashtable));
+		bzero(map,sizeof(turn_permission_hashtable));
 }
 
 static void free_turn_permission_hashtable(turn_permission_hashtable *map)
@@ -273,7 +273,7 @@ static void ch_info_clean(ch_info* c) {
 			c->kernel_channel = 0;
 		}
 		IOA_EVENT_DEL(c->lifetime_ev);
-		ns_bzero(c,sizeof(ch_info));
+		bzero(c,sizeof(ch_info));
 	}
 }
 
@@ -436,7 +436,7 @@ turn_permission_info* allocation_add_permission(allocation *a, const ioa_addr* a
 			}
 		}
 
-		ns_bzero(slot,sizeof(turn_permission_slot));
+		bzero(slot,sizeof(turn_permission_slot));
 		slot->info.allocated = 1;
 		turn_permission_info *elem = &(slot->info);
 		addr_cpy(&(elem->addr), addr);
@@ -487,7 +487,7 @@ ch_info *ch_map_get(ch_map* map, u16bits chnum, int new_chn)
 			size_t old_sz_mem = old_sz * sizeof(ch_info*);
 			a->extra_chns = (ch_info**)realloc(a->extra_chns,old_sz_mem + sizeof(ch_info*));
 			a->extra_chns[old_sz] = (ch_info*)malloc(sizeof(ch_info));
-			ns_bzero(a->extra_chns[old_sz],sizeof(ch_info));
+			bzero(a->extra_chns[old_sz],sizeof(ch_info));
 			a->extra_sz += 1;
 
 			return a->extra_chns[old_sz];
@@ -575,10 +575,10 @@ tcp_connection *create_tcp_connection(u08bits server_id, allocation *a, stun_tid
 		}
 	}
 	tcp_connection *tc = (tcp_connection*)malloc(sizeof(tcp_connection));
-	ns_bzero(tc,sizeof(tcp_connection));
+	bzero(tc,sizeof(tcp_connection));
 	addr_cpy(&(tc->peer_addr),peer_addr);
 	if(tid)
-		ns_bcopy(tid,&(tc->tid),sizeof(stun_tid));
+		bcopy(tid,&(tc->tid),sizeof(stun_tid));
 	tc->owner = a;
 
 	int found = 0;

+ 6 - 6
src/server/ns_turn_maps.c

@@ -239,7 +239,7 @@ int ur_map_unlock(const ur_map* map) {
 void lm_map_init(lm_map *map)
 {
 	if(map) {
-		ns_bzero(map,sizeof(lm_map));
+		bzero(map,sizeof(lm_map));
 	}
 }
 
@@ -590,7 +590,7 @@ static void addr_list_free(addr_list_header* slh) {
     if(slh->extra_list) {
       free(slh->extra_list);
     }
-    ns_bzero(slh,sizeof(addr_list_header));
+    bzero(slh,sizeof(addr_list_header));
   }
 }
     
@@ -802,7 +802,7 @@ static const addr_elem* addr_list_get_const(const addr_list_header* slh, const i
 
 void ur_addr_map_init(ur_addr_map* map) {
   if(map) {
-    ns_bzero(map,sizeof(ur_addr_map));
+    bzero(map,sizeof(ur_addr_map));
     map->magic=MAGIC_HASH;
   }
 }
@@ -813,7 +813,7 @@ void ur_addr_map_clean(ur_addr_map* map) {
     for(i=0;i<ADDR_MAP_SIZE;i++) {
       addr_list_free(&(map->lists[i]));
     }
-    ns_bzero(map,sizeof(ur_addr_map));
+    bzero(map,sizeof(ur_addr_map));
   }
 }
 
@@ -983,7 +983,7 @@ static string_list* string_list_add(string_list* sl, const ur_string_map_key_typ
   elem->list.next=sl;
   elem->key_size = strlen(key)+1;
   elem->key=(s08bits*)malloc(elem->key_size);
-  ns_bcopy(key,elem->key,elem->key_size);
+  bcopy(key,elem->key,elem->key_size);
   elem->value=value;
   return &(elem->list);
 }
@@ -1052,7 +1052,7 @@ static string_list_header* get_string_list_header(ur_string_map *map, const ur_s
 
 static int ur_string_map_init(ur_string_map* map) {
   if(map) {
-    ns_bzero(map,sizeof(ur_string_map));
+    bzero(map,sizeof(ur_string_map));
     map->magic=MAGIC_HASH;
 
     TURN_MUTEX_INIT_RECURSIVE(&(map->mutex));

+ 2 - 2
src/server/ns_turn_maps_rtcp.c

@@ -178,7 +178,7 @@ static int rtcp_map_init(rtcp_map* map, ioa_engine_handle e) {
 
 rtcp_map* rtcp_map_create(ioa_engine_handle e) {
   rtcp_map *map=(rtcp_map*)malloc(sizeof(rtcp_map));
-  ns_bzero(map,sizeof(rtcp_map));
+  bzero(map,sizeof(rtcp_map));
   if(rtcp_map_init(map,e)<0) {
     free(map);
     return NULL;
@@ -196,7 +196,7 @@ int rtcp_map_put(rtcp_map* map, rtcp_token_type token, ioa_socket_handle s) {
   else {
     rtcp_alloc_type *value=(rtcp_alloc_type*)malloc(sizeof(rtcp_alloc_type));
     if(!value) return -1;
-    ns_bzero(value,sizeof(rtcp_alloc_type));
+    bzero(value,sizeof(rtcp_alloc_type));
     value->s=s;
     value->t=turn_time() + RTCP_TIMEOUT;
     value->token=token;

+ 28 - 28
src/server/ns_turn_server.c

@@ -365,7 +365,7 @@ static inline ioa_socket_handle get_relay_socket_ss(ts_ur_super_session *ss, int
 
 void turn_session_info_init(struct turn_session_info* tsi) {
 	if(tsi) {
-		ns_bzero(tsi,sizeof(struct turn_session_info));
+		bzero(tsi,sizeof(struct turn_session_info));
 	}
 }
 
@@ -619,7 +619,7 @@ static int mobile_id_to_string(mobile_id_t mid, char *dst, size_t dst_sz)
 		return -1;
 	}
 
-	ns_bcopy(s, dst, output_length);
+	bcopy(s, dst, output_length);
 
 	free(s);
 
@@ -771,7 +771,7 @@ static ts_ur_super_session* create_new_ss(turn_turnserver* server) {
 	//printf("%s: 111.111: session size=%lu\n",__FUNCTION__,(unsigned long)sizeof(ts_ur_super_session));
 	//
 	ts_ur_super_session *ss = (ts_ur_super_session*)malloc(sizeof(ts_ur_super_session));
-	ns_bzero(ss,sizeof(ts_ur_super_session));
+	bzero(ss,sizeof(ts_ur_super_session));
 	ss->server = server;
 	get_default_realm_options(&(ss->realm_options));
 	put_session_into_map(ss);
@@ -1027,7 +1027,7 @@ static int handle_turn_allocate(turn_turnserver *server,
 						*reason = (const u08bits *)"User name is too long";
 						break;
 					}
-					ns_bcopy(value,username,ulen);
+					bcopy(value,username,ulen);
 					username[ulen]=0;
 					if(!is_secure_string(username,1)) {
 						TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: wrong username: %s\n", __FUNCTION__, (char*)username);
@@ -1450,16 +1450,16 @@ static int handle_turn_allocate(turn_turnserver *server,
 static void copy_auth_parameters(ts_ur_super_session *orig_ss, ts_ur_super_session *ss) {
 	if(orig_ss && ss) {
 		dec_quota(ss);
-		ns_bcopy(orig_ss->nonce,ss->nonce,sizeof(ss->nonce));
+		bcopy(orig_ss->nonce,ss->nonce,sizeof(ss->nonce));
 		ss->nonce_expiration_time = orig_ss->nonce_expiration_time;
-		ns_bcopy(&(orig_ss->realm_options),&(ss->realm_options),sizeof(ss->realm_options));
-		ns_bcopy(orig_ss->username,ss->username,sizeof(ss->username));
+		bcopy(&(orig_ss->realm_options),&(ss->realm_options),sizeof(ss->realm_options));
+		bcopy(orig_ss->username,ss->username,sizeof(ss->username));
 		ss->hmackey_set = orig_ss->hmackey_set;
-		ns_bcopy(orig_ss->hmackey,ss->hmackey,sizeof(ss->hmackey));
+		bcopy(orig_ss->hmackey,ss->hmackey,sizeof(ss->hmackey));
 		ss->oauth = orig_ss->oauth;
-		ns_bcopy(orig_ss->origin,ss->origin,sizeof(ss->origin));
+		bcopy(orig_ss->origin,ss->origin,sizeof(ss->origin));
 		ss->origin_set = orig_ss->origin_set;
-		ns_bcopy(orig_ss->pwd,ss->pwd,sizeof(ss->pwd));
+		bcopy(orig_ss->pwd,ss->pwd,sizeof(ss->pwd));
 		ss->max_session_time_auth = orig_ss->max_session_time_auth;
 		inc_quota(ss,ss->username);
 	}
@@ -1517,7 +1517,7 @@ static int handle_turn_refresh(turn_turnserver *server,
 					if(smid_len>0 && (((size_t)smid_len)<sizeof(smid))) {
 						const u08bits* smid_val = stun_attr_get_value(sar);
 						if(smid_val) {
-							ns_bcopy(smid_val, smid, (size_t)smid_len);
+							bcopy(smid_val, smid, (size_t)smid_len);
 							mid = string_to_mobile_id(smid);
 							if(is_allocation_valid(a) && (mid != ss->old_mobile_id)) {
 								*err_code = 400;
@@ -2033,7 +2033,7 @@ static void tcp_peer_connection_completed_callback(int success, void *arg)
 				u08bits *data = ioa_network_buffer_data(nbh_test);
 				const char* data_test="111.111.111.111.111";
 				len_test = strlen(data_test);
-				ns_bcopy(data_test,data,len_test);
+				bcopy(data_test,data,len_test);
 				ioa_network_buffer_set_size(nbh_test,len_test);
 				send_data_from_ioa_socket_nbh(tc->peer_s, NULL, nbh_test, TTL_IGNORE, TOS_IGNORE, NULL);
 			}
@@ -2170,7 +2170,7 @@ static void tcp_peer_accept_connection(ioa_socket_handle s, void *arg)
 		}
 
 		stun_tid tid;
-		ns_bzero(&tid,sizeof(stun_tid));
+		bzero(&tid,sizeof(stun_tid));
 		int err_code=0;
 		tc = create_tcp_connection(server->id, a, &tid, peer_addr, &err_code);
 		if(!tc) {
@@ -3229,11 +3229,11 @@ static void resume_processing_after_username_check(int success,  int oauth, int
 			turn_turnserver *server = (turn_turnserver *)ss->server;
 
 			if(success) {
-				ns_bcopy(hmackey,ss->hmackey,sizeof(hmackey_t));
+				bcopy(hmackey,ss->hmackey,sizeof(hmackey_t));
 				ss->hmackey_set = 1;
 				ss->oauth = oauth;
 				ss->max_session_time_auth = (turn_time_t)max_session_time;
-				ns_bcopy(pwd,ss->pwd,sizeof(password_t));
+				bcopy(pwd,ss->pwd,sizeof(password_t));
 				if(realm && realm[0] && strcmp((char*)realm,ss->realm_options.name)) {
 					dec_quota(ss);
 					get_realm_options_by_name((char*)realm, &(ss->realm_options));
@@ -3343,7 +3343,7 @@ static int check_stun_auth(turn_turnserver *server,
 		}
 
 		alen = min((size_t)stun_attr_get_len(sar),sizeof(realm)-1);
-		ns_bcopy(stun_attr_get_value(sar),realm,alen);
+		bcopy(stun_attr_get_value(sar),realm,alen);
 		realm[alen]=0;
 
 		if(!is_secure_string(realm,0)) {
@@ -3368,7 +3368,7 @@ static int check_stun_auth(turn_turnserver *server,
 				}
 				return -1;
 			} else {
-				ns_bcopy(ss->realm_options.name,realm,sizeof(ss->realm_options.name));
+				bcopy(ss->realm_options.name,realm,sizeof(ss->realm_options.name));
 			}
 		}
 	}
@@ -3385,7 +3385,7 @@ static int check_stun_auth(turn_turnserver *server,
 	}
 
 	alen = min((size_t)stun_attr_get_len(sar),sizeof(usname)-1);
-	ns_bcopy(stun_attr_get_value(sar),usname,alen);
+	bcopy(stun_attr_get_value(sar),usname,alen);
 	usname[alen]=0;
 
 	if(!is_secure_string(usname,1)) {
@@ -3425,7 +3425,7 @@ static int check_stun_auth(turn_turnserver *server,
 		}
 
 		alen = min((size_t)stun_attr_get_len(sar),sizeof(nonce)-1);
-		ns_bcopy(stun_attr_get_value(sar),nonce,alen);
+		bcopy(stun_attr_get_value(sar),nonce,alen);
 		nonce[alen]=0;
 
 		/* Stale Nonce check: */
@@ -3612,7 +3612,7 @@ static int handle_turn_command(turn_turnserver *server, ts_ur_super_session *ss,
 						if(sarlen>0) {
 							++norigins;
 							char *o = (char*)malloc(sarlen+1);
-							ns_bcopy(stun_attr_get_value(sar),o,sarlen);
+							bcopy(stun_attr_get_value(sar),o,sarlen);
 							o[sarlen]=0;
 							char *corigin = (char*)malloc(STUN_MAX_ORIGIN_SIZE+1);
 							corigin[0]=0;
@@ -3668,7 +3668,7 @@ static int handle_turn_command(turn_turnserver *server, ts_ur_super_session *ss,
 						int sarlen = stun_attr_get_len(sar);
 						if(sarlen>0) {
 							char *o = (char*)malloc(sarlen+1);
-							ns_bcopy(stun_attr_get_value(sar),o,sarlen);
+							bcopy(stun_attr_get_value(sar),o,sarlen);
 							o[sarlen]=0;
 							char *corigin = (char*)malloc(STUN_MAX_ORIGIN_SIZE+1);
 							corigin[0]=0;
@@ -3985,10 +3985,10 @@ static int handle_old_stun_command(turn_turnserver *server, ts_ur_super_session
 					size_t oldsz = strlen(get_version(server));
 					size_t newsz = (((oldsz)>>2) + 1)<<2;
 					u08bits software[120];
-					ns_bzero(software,sizeof(software));
+					bzero(software,sizeof(software));
 					if(newsz>sizeof(software))
 						newsz = sizeof(software);
-					ns_bcopy(get_version(server),software,oldsz);
+					bcopy(get_version(server),software,oldsz);
 					size_t len = ioa_network_buffer_get_size(nbh);
 					stun_attr_add_str(ioa_network_buffer_data(nbh), &len, OLD_STUN_ATTRIBUTE_SERVER, software, newsz);
 					ioa_network_buffer_set_size(nbh, len);
@@ -4039,10 +4039,10 @@ static int handle_old_stun_command(turn_turnserver *server, ts_ur_super_session
 			size_t oldsz = strlen(get_version(server));
 			size_t newsz = (((oldsz)>>2) + 1)<<2;
 			u08bits software[120];
-			ns_bzero(software,sizeof(software));
+			bzero(software,sizeof(software));
 			if(newsz>sizeof(software))
 				newsz = sizeof(software);
-			ns_bcopy(get_version(server),software,oldsz);
+			bcopy(get_version(server),software,oldsz);
 			size_t len = ioa_network_buffer_get_size(nbh);
 			stun_attr_add_str(ioa_network_buffer_data(nbh), &len, OLD_STUN_ATTRIBUTE_SERVER, software, newsz);
 			ioa_network_buffer_set_size(nbh, len);
@@ -4326,7 +4326,7 @@ static int create_relay_connection(turn_turnserver* server,
 
 				IOA_CLOSE_SOCKET(newelem->s);
 
-				ns_bzero(newelem, sizeof(relay_endpoint_session));
+				bzero(newelem, sizeof(relay_endpoint_session));
 				newelem->s = s;
 			}
 
@@ -4340,7 +4340,7 @@ static int create_relay_connection(turn_turnserver* server,
 
 			IOA_CLOSE_SOCKET(newelem->s);
 
-			ns_bzero(newelem, sizeof(relay_endpoint_session));
+			bzero(newelem, sizeof(relay_endpoint_session));
 			newelem->s = NULL;
 
 			int res = create_relay_ioa_sockets(server->e,
@@ -4866,7 +4866,7 @@ void init_turn_server(turn_turnserver* server,
 	if (!server)
 		return;
 
-	ns_bzero(server,sizeof(turn_turnserver));
+	bzero(server,sizeof(turn_turnserver));
 
 	server->e = e;
 	server->id = id;