Lines Matching refs:dev
69 struct device dev; /* What struct physical knows about */
85 struct udpdevice *dev = device2udp(p->handler);
88 switch (dev->connected) {
95 ret = sendto(p->fd, v, n, 0, (struct sockaddr *)&dev->sock,
96 sizeof dev->sock);
99 if (dev->connected == UDP_MAYBEUNCONNECTED) {
101 dev->connected = UDP_CONNECTED;
104 dev->connected = UDP_UNCONNECTED;
113 struct udpdevice *dev = device2udp(p->handler);
116 if (dev->connected == UDP_CONNECTED)
119 sz = sizeof dev->sock;
120 ret = recvfrom(p->fd, v, n, 0, (struct sockaddr *)&dev->sock, &sz);
124 inet_ntoa(dev->sock.sin_addr), ntohs(dev->sock.sin_port));
134 struct udpdevice *dev = device2udp(p->handler);
136 free(dev);
180 struct udpdevice *dev = (struct udpdevice *)iov[(*niov)++].iov_base;
182 dev = realloc(dev, sizeof *dev); /* Reduce to the correct size */
183 if (dev == NULL) {
185 (int)(sizeof *dev));
190 memcpy(&dev->dev, &baseudpdevice, sizeof dev->dev);
192 physical_SetupStack(p, dev->dev.name, PHYSICAL_FORCE_SYNC);
193 return &dev->dev;
202 struct udpdevice *dev;
205 if ((dev = malloc(sizeof *dev)) == NULL) {
211 dev->sock.sin_family = AF_INET;
212 dev->sock.sin_addr = GetIpAddr(host);
213 if (dev->sock.sin_addr.s_addr == INADDR_NONE) {
215 free(dev);
218 dev->sock.sin_port = htons(atoi(port));
219 if (dev->sock.sin_port == 0) {
222 dev->sock.sin_port = sp->s_port;
225 free(dev);
237 if (connect(p->fd, (struct sockaddr *)&dev->sock, sizeof dev->sock) == 0) {
238 dev->connected = UDP_CONNECTED;
239 return dev;
247 free(dev);
256 struct udpdevice *dev;
258 dev = NULL;
275 dev = udp_CreateDevice(p, host, port);
300 if ((dev = malloc(sizeof *dev)) == NULL) {
309 dev->connected = UDP_CONNECTED;
314 dev->connected = UDP_MAYBEUNCONNECTED;
326 if (dev) {
327 memcpy(&dev->dev, &baseudpdevice, sizeof dev->dev);
328 physical_SetupStack(p, dev->dev.name, PHYSICAL_FORCE_SYNC);
331 return &dev->dev;