struct endpoint * endpoint_clone(struct endpoint const *src) { struct endpoint *new_end = tnt_new(struct endpoint); endpoint_copy(new_end, src); return new_end; }
static dsme_swwd_entry_t* swwd_entry_new(pid_t pid, endpoint_t* client) { dsme_swwd_entry_t* proc = (dsme_swwd_entry_t*)malloc(sizeof(dsme_swwd_entry_t)); if (proc == NULL) { dsme_log(LOG_CRIT, "%s", strerror(errno)); } else { proc->pid = pid; proc->pingcount = 0; /* TODO: it is a bit risky to copy an endpoint */ proc->client = endpoint_copy(client); proc->kill_timer = 0; } return proc; }
struct dacp_client_t* dacp_client_create(endpoint_p endpoint, const char* identifier, const char* active_remote) { struct dacp_client_t* dc = (struct dacp_client_t*)object_create(sizeof(struct dacp_client_t), _dacp_client_destroy); dc->endpoint = endpoint_copy(endpoint); endpoint_set_port(dc->endpoint, 3689); dc->identifier = malloc(strlen(identifier) + 1); strcpy(dc->identifier, identifier); dc->active_remove = malloc(strlen(active_remote) + 1); strcpy(dc->active_remove, active_remote); dc->dacp_discover = zeroconf_dacp_discover_create(); zeroconf_dacp_discover_set_callback(dc->dacp_discover, _dacp_client_zeroconf_resolved_callback, dc); dc->playback_state = dacp_client_playback_state_stopped; return dc; }