also dump filter mode and sources in 'ipv4_multicast'.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20966 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1554,9 +1554,21 @@ dump_ipv4_multicast(int argc, char *argv[])
|
|||||||
|
|
||||||
char addrBuf[64];
|
char addrBuf[64];
|
||||||
|
|
||||||
kprintf("%p: group <%s, %s> sock %p\n", state,
|
kprintf("%p: group <%s, %s, %s {", state, state->Interface()->name,
|
||||||
state->Interface()->name, print_address(&state->Address(),
|
print_address(&state->Address(), addrBuf, sizeof(addrBuf)),
|
||||||
addrBuf, sizeof(addrBuf)), state->Parent()->Socket());
|
state->Mode() == IPv4GroupInterface::kExclude ? "Exclude" :
|
||||||
|
"Include");
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
IPv4GroupInterface::AddressSet::Iterator it =
|
||||||
|
state->Sources().GetIterator();
|
||||||
|
while (it.HasNext()) {
|
||||||
|
kprintf("%s%s", count > 0 ? ", " : "", print_address(&it.Next(),
|
||||||
|
addrBuf, sizeof(addrBuf)));
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
kprintf("}> sock %p\n", state->Parent()->Socket());
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -43,11 +43,16 @@ struct IPv4Multicast {
|
|||||||
|
|
||||||
template<typename AddressType>
|
template<typename AddressType>
|
||||||
class AddressSet {
|
class AddressSet {
|
||||||
public:
|
|
||||||
struct ContainedAddress : DoublyLinkedListLinkImpl<ContainedAddress> {
|
struct ContainedAddress : DoublyLinkedListLinkImpl<ContainedAddress> {
|
||||||
AddressType address;
|
AddressType address;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef DoublyLinkedList<ContainedAddress> AddressList;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AddressSet()
|
||||||
|
: fCount(0) {}
|
||||||
|
|
||||||
~AddressSet() { Clear(); }
|
~AddressSet() { Clear(); }
|
||||||
|
|
||||||
status_t Add(const AddressType &address)
|
status_t Add(const AddressType &address)
|
||||||
@@ -88,9 +93,21 @@ public:
|
|||||||
Remove(fAddresses.Head()->address);
|
Remove(fAddresses.Head()->address);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
class Iterator {
|
||||||
typedef DoublyLinkedList<ContainedAddress> AddressList;
|
public:
|
||||||
|
Iterator(const AddressList &addresses)
|
||||||
|
: fBaseIterator(addresses.GetIterator()) {}
|
||||||
|
|
||||||
|
bool HasNext() const { return fBaseIterator.HasNext(); }
|
||||||
|
AddressType &Next() { return fBaseIterator.Next()->address; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
typename AddressList::ConstIterator fBaseIterator;
|
||||||
|
};
|
||||||
|
|
||||||
|
Iterator GetIterator() const { return Iterator(fAddresses); }
|
||||||
|
|
||||||
|
private:
|
||||||
ContainedAddress *_Get(const AddressType &address) const
|
ContainedAddress *_Get(const AddressType &address) const
|
||||||
{
|
{
|
||||||
typename AddressList::ConstIterator it = fAddresses.GetIterator();
|
typename AddressList::ConstIterator it = fAddresses.GetIterator();
|
||||||
@@ -103,6 +120,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
AddressList fAddresses;
|
AddressList fAddresses;
|
||||||
|
int fCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -114,6 +132,7 @@ public:
|
|||||||
typedef HashTableLink<ThisType> HashLink;
|
typedef HashTableLink<ThisType> HashLink;
|
||||||
typedef typename Addressing::AddressType AddressType;
|
typedef typename Addressing::AddressType AddressType;
|
||||||
typedef MulticastFilter<Addressing> Filter;
|
typedef MulticastFilter<Addressing> Filter;
|
||||||
|
typedef AddressSet<AddressType> AddressSet;
|
||||||
|
|
||||||
enum FilterMode {
|
enum FilterMode {
|
||||||
kInclude,
|
kInclude,
|
||||||
@@ -139,6 +158,9 @@ public:
|
|||||||
bool IsEmpty() const;
|
bool IsEmpty() const;
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
|
FilterMode Mode() const { return fFilterMode; }
|
||||||
|
const AddressSet &Sources() const { return fAddresses; }
|
||||||
|
|
||||||
bool FilterAccepts(net_buffer *buffer) const;
|
bool FilterAccepts(net_buffer *buffer) const;
|
||||||
|
|
||||||
struct HashDefinition {
|
struct HashDefinition {
|
||||||
@@ -165,7 +187,7 @@ private:
|
|||||||
AddressType fMulticastAddress;
|
AddressType fMulticastAddress;
|
||||||
net_interface *fInterface;
|
net_interface *fInterface;
|
||||||
FilterMode fFilterMode;
|
FilterMode fFilterMode;
|
||||||
AddressSet<AddressType> fAddresses;
|
AddressSet fAddresses;
|
||||||
HashLink fLink;
|
HashLink fLink;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user