Lines Matching defs:port
25 * internet address/port binding
35 portbind(register Cs_t* state, const char* type, unsigned long addr, unsigned int port)
47 if ((fd = udp_datagram(port)) < 0)
52 if ((fd = udp_connect(0, addr, port)) < 0)
64 tcp.fport = port;
69 state->port = tcp.lport;
102 state->port = port;
103 nam.sin_port = htons(port);
151 state->port = port;
161 if (state->port != CS_PORT_NORMAL)
173 state->port = ntohs((unsigned short)nam.sin_port);
196 * create [addr==0] or open stream fd for <type,addr,port>
201 * port CS_PORT_NORMAL for normal port allocation
202 * CS_PORT_RESERVED for reserved port allocation
206 csbind(register Cs_t* state, const char* type, unsigned long addr, unsigned long port, unsigned long clone)
210 messagef((state->id, NiL, -8, "bind(%s,%s,%u,%lu) call", type, csntoa(state, addr), port, clone));
211 if (port == CS_PORT_INVALID)
213 if (port == CS_PORT_RESERVED)
220 messagef((state->id, NiL, -1, "bind: %s: explicit reserved port invalid", csntoa(state, addr)));
223 port = last;
227 port = IPPORT_RESERVED - 1;
228 if (last == port)
237 messagef((state->id, NiL, -1, "bind: reserved port allocation error"));
240 if (port == CS_PORT_NORMAL && addr)
245 if ((fd = portbind(state, type, addr, port)) < 0)
256 messagef((state->id, NiL, -8, "bind(%s,%s,%u,%lu) = %d", type, csntoa(state, addr), port, clone, fd));
261 _cs_bind(const char* type, unsigned long addr, unsigned long port, unsigned long clone)
263 return csbind(&cs, type, addr, port, clone);