Changeset 342 for asp3_tinet_ecnl_rx/trunk/asp3_dcre/tinet/net/ethernet.c
- Timestamp:
- Apr 27, 2018, 2:26:14 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
asp3_tinet_ecnl_rx/trunk/asp3_dcre/tinet/net/ethernet.c
r337 r342 29 29 * 接的または間接的に生じたいかなる損害に関しても,その責任を負わない. 30 30 * 31 * @(#) $Id $31 * @(#) $Id: ethernet.c 1524 2018-04-25 13:48:23Z coas-nagasima $ 32 32 */ 33 33 … … 195 195 196 196 /** 197 * Called by a driver when its link goes up 198 */ 199 void ether_set_link_up() 200 { 201 if (!(ether_ifnet.flags & IF_FLAG_LINK_UP)) { 202 ether_ifnet.flags |= IF_FLAG_LINK_UP; 203 204 if (ether_ifnet.flags & IF_FLAG_UP) { 205 #if LWIP_ARP 206 /* For Ethernet network interfaces, we would like to send a "gratuitous ARP" */ 207 if (ether_ifnet.flags & IF_FLAG_ETHARP) { 208 etharp_gratuitous(ðer_ifnet); 209 } 210 #endif /* LWIP_ARP */ 211 212 #if LWIP_IGMP 213 /* resend IGMP memberships */ 214 if (ether_ifnet._flags & IF_FLAG_IGMP) { 215 igmp_report_groups(ðer_ifnet); 216 } 217 #endif /* LWIP_IGMP */ 218 } 219 if (ether_ifnet.link_callback) { 220 (ether_ifnet.link_callback)(ðer_ifnet); 221 } 222 } 223 } 197 * ether_set_link_up -- リンクしたときにNICから呼び出される 198 */ 199 void 200 ether_set_link_up() 201 { 202 if (!(ether_ifnet.flags & IF_FLAG_LINK_UP)) { 203 ether_ifnet.flags |= IF_FLAG_LINK_UP; 204 205 if (ether_ifnet.flags & IF_FLAG_UP) { 206 #if defined(_IP4_CFG) && defined(SUPPORT_ETHER) 207 /* ARP再構築? */ 208 #endif /* #if defined(_IP4_CFG) && defined(SUPPORT_ETHER) */ 209 210 #ifdef SUPPORT_IGMP 211 /* IGMP参加 */ 212 #endif /* #ifdef SUPPORT_IGMP */ 213 } 214 if (ether_ifnet.link_callback) { 215 (ether_ifnet.link_callback)(ðer_ifnet); 216 } 217 } 218 } 224 219 225 220 /** 226 * Called by a driver when its link goes down 227 */ 228 void ether_set_link_down() 229 { 230 if (ether_ifnet.flags & IF_FLAG_LINK_UP) { 231 ether_ifnet.flags &= ~IF_FLAG_LINK_UP; 232 if (ether_ifnet.link_callback) { 233 (ether_ifnet.link_callback)(ðer_ifnet); 234 } 235 } 236 } 237 238 void ether_set_up() 239 { 240 if (!(ether_ifnet.flags & IF_FLAG_UP)) { 241 ether_ifnet.flags |= IF_FLAG_UP; 242 if (ether_ifnet.link_callback) { 243 (ether_ifnet.link_callback)(ðer_ifnet); 244 } 245 } 246 } 247 248 void ether_set_down() 249 { 250 if (ether_ifnet.flags & IF_FLAG_UP) { 251 ether_ifnet.flags &= ~IF_FLAG_UP; 252 if (ether_ifnet.link_callback) { 253 (ether_ifnet.link_callback)(ðer_ifnet); 254 } 255 } 256 } 257 258 /** 259 * Set callback to be called when link is brought up/down 260 */ 261 void ether_set_link_callback(ether_status_callback_fn link_callback) 221 * ether_set_link_up -- リンクが切断したときにNICから呼び出される 222 */ 223 void 224 ether_set_link_down() 225 { 226 if (ether_ifnet.flags & IF_FLAG_LINK_UP) { 227 ether_ifnet.flags &= ~IF_FLAG_LINK_UP; 228 if (ether_ifnet.link_callback) { 229 (ether_ifnet.link_callback)(ðer_ifnet); 230 } 231 } 232 } 233 234 /* 235 * ether_set_up -- DHCPでアドレスが設定されたとき呼び出される 236 */ 237 238 void 239 ether_set_up() 240 { 241 if (!(ether_ifnet.flags & IF_FLAG_UP)) { 242 ether_ifnet.flags |= IF_FLAG_UP; 243 if (ether_ifnet.link_callback) { 244 (ether_ifnet.link_callback)(ðer_ifnet); 245 } 246 } 247 } 248 249 /* 250 * ether_set_down -- DHCPでアドレスが解放されたとき呼び出される 251 */ 252 253 void 254 ether_set_down() 255 { 256 if (ether_ifnet.flags & IF_FLAG_UP) { 257 ether_ifnet.flags &= ~IF_FLAG_UP; 258 if (ether_ifnet.link_callback) { 259 (ether_ifnet.link_callback)(ðer_ifnet); 260 } 261 } 262 } 263 264 /* 265 * ether_set_link_callback -- リンク状態変化時のコールバック登録 266 */ 267 268 void 269 ether_set_link_callback(ether_status_callback_fn link_callback) 262 270 { 263 271 ether_ifnet.link_callback = link_callback; 264 } 272 if (ether_ifnet.link_callback) { 273 (ether_ifnet.link_callback)(ðer_ifnet); 274 } 275 } 265 276 266 277 /*
Note:
See TracChangeset
for help on using the changeset viewer.