Lines Matching refs:entry

187 get_request_buffer(arp_entry* entry)
189 net_buffer* buffer = entry->request_buffer;
193 buffer = atomic_pointer_test_and_set(&entry->request_buffer,
203 put_request_buffer(arp_entry* entry, net_buffer* buffer)
206 &entry->request_buffer, buffer, (net_buffer*)NULL);
215 delete_request_buffer(arp_entry* entry)
217 net_buffer* buffer = atomic_pointer_get_and_set(&entry->request_buffer,
264 arp_entry *entry = new (std::nothrow) arp_entry;
265 if (entry == NULL)
268 entry->protocol_address = protocolAddress;
269 entry->flags = flags;
270 entry->timestamp = system_time();
271 entry->protocol = NULL;
272 entry->request_buffer = NULL;
273 entry->timer_state = ARP_NO_STATE;
274 sStackModule->init_timer(&entry->timer, arp_timer, entry);
277 // this entry is already resolved
278 entry->hardware_address = *hardwareAddress;
279 entry->hardware_address.sdl_e_type = htons(ETHER_TYPE_IP);
281 // this entry still needs to be resolved
282 entry->hardware_address.sdl_alen = 0;
284 if (entry->hardware_address.sdl_len != sizeof(sockaddr_dl)) {
286 entry->hardware_address.sdl_len = sizeof(sockaddr_dl);
289 if (sCache->Insert(entry) != B_OK) {
290 // We can delete the entry here with the sCacheLock held, since it's
292 delete entry;
296 return entry;
325 TRACE(("ARP entry %p Marked as FAILED\n", this));
335 TRACE(("ARP entry %p Marked as VALID, have %li packets queued.\n", this,
357 // schedule a timer to remove this entry
366 /*! Updates the entry determined by \a protocolAddress with the specified
368 If such an entry does not exist yet, a new entry is added. If you try
369 to update a local existing entry but didn't ask for it (by setting
384 arp_entry *entry = arp_entry::Lookup(protocolAddress);
385 if (entry != NULL) {
392 && entry->hardware_address.sdl_alen != 0
393 && memcmp(LLADDR(&entry->hardware_address),
402 entry->hardware_address = *hardwareAddress;
403 entry->timestamp = system_time();
405 entry = arp_entry::Add(protocolAddress, hardwareAddress, flags);
406 if (entry == NULL)
410 delete_request_buffer(entry);
412 if ((entry->flags & ARP_FLAG_PERMANENT) == 0) {
414 entry->timer_state = ARP_STATE_STALE;
415 sStackModule->set_timer(&entry->timer, ARP_STALE_TIMEOUT);
418 if ((entry->flags & ARP_FLAG_REJECT) != 0)
419 entry->MarkFailed();
421 entry->MarkValid();
424 *_entry = entry;
462 arp_entry* entry;
464 ARP_FLAG_LOCAL | ARP_FLAG_PERMANENT, &entry);
466 entry->protocol = protocol;
488 arp_entry* entry = arp_entry::Lookup(inetAddress);
489 if (entry != NULL) {
490 sCache->Remove(entry);
491 entry->flags |= ARP_FLAG_REMOVED;
511 delete entry;
539 Returns an error if no entry could be added.
581 arp_entry *entry = arp_entry::Lookup(header.protocol_target);
582 if (entry == NULL || entry->protocol == NULL
583 || (entry->flags & (ARP_FLAG_LOCAL | ARP_FLAG_PUBLISH)) == 0) {
598 memcpy(header.hardware_sender, LLADDR(&entry->hardware_address),
600 header.protocol_sender = entry->protocol_address;
612 return entry->protocol->next->module->send_data(entry->protocol->next,
686 arp_entry *entry = (arp_entry *)data;
687 TRACE(("ARP timer %ld, entry %p!\n", entry->timer_state, entry));
689 switch (entry->timer_state) {
695 // Requesting the ARP entry failed, we keep it around for a while,
698 TRACE((" requesting ARP entry %p failed!\n", entry));
699 entry->timer_state = ARP_STATE_REMOVE_FAILED;
700 entry->MarkFailed();
701 sStackModule->set_timer(&entry->timer, ARP_REJECT_TIMEOUT);
707 // the entry has aged so much that we're going to remove it
708 TRACE((" remove ARP entry %p!\n", entry));
711 if ((entry->flags & ARP_FLAG_REMOVED) != 0) {
712 // The entry has already been removed, and is about to be
717 sCache->Remove(entry);
720 delete entry;
726 if (entry->timer_state > ARP_STATE_LAST_REQUEST
727 || entry->protocol == NULL)
730 TRACE((" send request for ARP entry %p!\n", entry));
732 net_buffer *request = get_request_buffer(entry);
736 if (entry->timer_state < ARP_STATE_LAST_REQUEST) {
743 entry->timer_state = ARP_STATE_LAST_REQUEST;
745 put_request_buffer(entry, request);
751 status_t status = entry->protocol->next->module->send_data(
752 entry->protocol->next, request);
756 entry->timer_state++;
757 sStackModule->set_timer(&entry->timer, ARP_REQUEST_TIMEOUT);
774 // create an unresolved ARP entry as a placeholder
775 arp_entry *entry = arp_entry::Add(address, NULL, 0);
776 if (entry == NULL)
781 entry->request_buffer = gBufferModule->create(256);
782 if (entry->request_buffer == NULL) {
783 entry->ScheduleRemoval();
787 NetBufferPrepend<arp_header> bufferHeader(entry->request_buffer);
790 entry->ScheduleRemoval();
813 entry->request_buffer->source;
823 entry->request_buffer->flags = MSG_BCAST;
826 entry->protocol = protocol;
827 entry->timer_state = ARP_STATE_REQUEST;
828 sStackModule->set_timer(&entry->timer, 0);
831 *_entry = entry;
870 arp_entry *entry = arp_entry::Lookup(control.address);
871 if (entry == NULL || !(entry->flags & ARP_FLAG_VALID))
874 if (entry->hardware_address.sdl_alen == ETHER_ADDRESS_LENGTH) {
876 entry->hardware_address.sdl_data, ETHER_ADDRESS_LENGTH);
880 control.flags = entry->flags & ARP_PUBLIC_FLAG_MASK;
888 arp_entry *entry = NULL;
892 entry = iterator.Next();
896 control.address = entry->protocol_address;
897 if (entry->hardware_address.sdl_alen == ETHER_ADDRESS_LENGTH) {
899 entry->hardware_address.sdl_data, ETHER_ADDRESS_LENGTH);
902 control.flags = entry->flags & ARP_PUBLIC_FLAG_MASK;
909 arp_entry *entry = arp_entry::Lookup(control.address);
910 if (entry == NULL)
912 if ((entry->flags & ARP_FLAG_LOCAL) != 0)
915 entry->ScheduleRemoval();
923 arp_entry *entry;
925 entry = iterator.Next();
927 if ((entry->flags & ARP_FLAG_LOCAL) != 0)
930 entry->ScheduleRemoval();
1035 arp_entry *entry = arp_entry::Lookup(
1037 if (entry == NULL) {
1040 &entry);
1045 if ((entry->flags & ARP_FLAG_REJECT) != 0)
1048 if ((entry->flags & ARP_FLAG_VALID) == 0) {
1049 // entry is still being resolved.
1050 TRACE(("ARP Queuing packet %p, entry still being resolved.\n",
1052 entry->queue.Add(buffer);
1056 memcpy(buffer->destination, &entry->hardware_address,
1057 entry->hardware_address.sdl_len);
1114 // Update ARP entry for the local address