Revision c039490c src/pschannel.c

View differences:

src/pschannel.c
49 49
	return pb;
50 50
}
51 51

  
52
uint8_t pschannel_bucket_insert(struct pschannel_bucket * pb, char * name, char * ip, char * port, char * quality)
52
uint8_t pschannel_bucket_insert(struct pschannel_bucket * pb, char * name, char * ip, char * port, char * quality, char * sdpfile)
53 53
{
54 54
	struct pschannel * ch;
55 55
	void * res;
56 56

  
57
	if (pb && name && ip && port && quality)
57
	if (pb && name && ip && port && quality && sdpfile)
58 58
	{
59 59
		ch = (struct pschannel *) malloc(sizeof(struct pschannel));
60 60
		memset(ch, 0, sizeof(struct pschannel));
......
62 62
		strncpy(ch->ipaddr, ip, MAX_IPADDR_LENGTH-1);
63 63
		strncpy(ch->port, port, MAX_PORT_LENGTH-1);
64 64
		strncpy(ch->quality, quality, MAX_QUALITY_LENGTH-1);
65
		strncpy(ch->sdpfile, sdpfile, MAX_SDPFILENAME_LENGTH-1);
65 66

  
66 67
		res = ord_set_insert(pb->channels, ch, 0);
67 68
		if (res != ch)  // there is a conflict
......
121 122

  
122 123
	return res;
123 124
}
125

  
126
const struct pschannel * pschannel_bucket_find(const struct pschannel_bucket * psb, const char * ipaddr, const char * port)
127
{
128
	struct pschannel ch;
129
	
130
	if (ipaddr && port)
131
	{
132
		strncpy(ch.ipaddr, ipaddr, MAX_IPADDR_LENGTH);
133
		strncpy(ch.port, port, MAX_PORT_LENGTH);
134
		return (const struct pschannel *) ord_set_find(psb->channels, &ch);
135

  
136
	} else
137
		return NULL;
138
}

Also available in: Unified diff