| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: net.c,v 1.33 2009/01/31 04:11:28 isaki Exp $ */ | | 1 | /* $NetBSD: net.c,v 1.34 2009/01/31 06:22:46 isaki Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1992 Regents of the University of California. | | 4 | * Copyright (c) 1992 Regents of the University of California. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This software was developed by the Computer Systems Engineering group | | 7 | * This software was developed by the Computer Systems Engineering group |
8 | * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and | | 8 | * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and |
9 | * contributed to Berkeley. | | 9 | * contributed to Berkeley. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -45,40 +45,39 @@ | | | @@ -45,40 +45,39 @@ |
45 | #ifdef _STANDALONE | | 45 | #ifdef _STANDALONE |
46 | #include <lib/libkern/libkern.h> | | 46 | #include <lib/libkern/libkern.h> |
47 | #else | | 47 | #else |
48 | #include <string.h> | | 48 | #include <string.h> |
49 | #endif | | 49 | #endif |
50 | | | 50 | |
51 | #include <net/if.h> | | 51 | #include <net/if.h> |
52 | #include <net/if_ether.h> | | 52 | #include <net/if_ether.h> |
53 | | | 53 | |
54 | #include <netinet/in.h> | | 54 | #include <netinet/in.h> |
55 | #include <netinet/in_systm.h> | | 55 | #include <netinet/in_systm.h> |
56 | #include <netinet/ip.h> | | 56 | #include <netinet/ip.h> |
57 | | | 57 | |
58 | #include "net.h" | | | |
59 | | | | |
60 | #ifdef _STANDALONE | | 58 | #ifdef _STANDALONE |
61 | #include "stand.h" | | 59 | #include "stand.h" |
62 | #define delay() | | 60 | #define delay() |
63 | #else | | 61 | #else |
64 | #include <errno.h> | | 62 | #include <errno.h> |
65 | #include <stdio.h> | | 63 | #include <stdio.h> |
66 | #include <unistd.h> | | 64 | #include <unistd.h> |
67 | #define panic printf | | 65 | #define panic printf |
68 | #define delay() usleep(100000) | | 66 | #define delay() usleep(100000) |
69 | #define getsecs() time(NULL) | | 67 | #define getsecs() time(NULL) |
70 | #endif | | 68 | #endif |
71 | | | 69 | |
| | | 70 | #include "net.h" |
72 | | | 71 | |
73 | /* | | 72 | /* |
74 | * Send a packet and wait for a reply, with exponential backoff. | | 73 | * Send a packet and wait for a reply, with exponential backoff. |
75 | * | | 74 | * |
76 | * The send routine must return the actual number of bytes written, | | 75 | * The send routine must return the actual number of bytes written, |
77 | * or -1 on error. | | 76 | * or -1 on error. |
78 | * | | 77 | * |
79 | * The receive routine can indicate success by returning the number of | | 78 | * The receive routine can indicate success by returning the number of |
80 | * bytes read; it can return 0 to indicate EOF; it can return -1 with a | | 79 | * bytes read; it can return 0 to indicate EOF; it can return -1 with a |
81 | * non-zero errno to indicate failure; finally, it can return -1 with a | | 80 | * non-zero errno to indicate failure; finally, it can return -1 with a |
82 | * zero errno to indicate it isn't done yet. | | 81 | * zero errno to indicate it isn't done yet. |
83 | */ | | 82 | */ |
84 | ssize_t | | 83 | ssize_t |