123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- /*++
- Copyright (c) 2016 Minoca Corp. All Rights Reserved
- Module Name:
- generic.h
- Abstract:
- This header contains definitions for the generic netlink protocol.
- Author:
- Chris Stevens 10-Feb-2016
- --*/
- //
- // ------------------------------------------------------------------- Includes
- //
- //
- // ---------------------------------------------------------------- Definitions
- //
- #define NETLINK_GENERIC_ALLOCATION_TAG 0x65676C4E // 'eglN'
- //
- // ------------------------------------------------------ Data Type Definitions
- //
- /*++
- Structure Description:
- This structure defines a generic netlink family.
- Members:
- TreeNode - Stores a node in the global tree of generic netlink families.
- ReferenceCount - Stores the number of references take on the family.
- MulticastGroupOffset - Stores the offset into the entire generic netlink
- multicast group ID namespace where this family's multicast group IDs
- begin.
- Properties - Stores the generic netlink family properties, including its ID
- name, and interface.
- --*/
- struct _NETLINK_GENERIC_FAMILY {
- RED_BLACK_TREE_NODE TreeNode;
- volatile ULONG ReferenceCount;
- ULONG MulticastGroupOffset;
- NETLINK_GENERIC_FAMILY_PROPERTIES Properties;
- };
- //
- // -------------------------------------------------------------------- Globals
- //
- //
- // Store the lock and tree for storing the generic netlink families.
- //
- extern PSHARED_EXCLUSIVE_LOCK NetlinkGenericFamilyLock;
- extern RED_BLACK_TREE NetlinkGenericFamilyTree;
- //
- // -------------------------------------------------------- Function Prototypes
- //
- VOID
- NetlinkpGenericControlInitialize (
- VOID
- );
- /*++
- Routine Description:
- This routine initializes the built in generic netlink control family.
- Arguments:
- None.
- Return Value:
- None.
- --*/
- KSTATUS
- NetlinkpGenericControlSendNotification (
- PNETLINK_GENERIC_FAMILY Family,
- UCHAR Command,
- PNETLINK_GENERIC_MULTICAST_GROUP Group
- );
- /*++
- Routine Description:
- This routine sends a generic netlink control command based on the family
- and or group information.
- Arguments:
- Family - Supplies a pointer to the generic netlink family for which the
- command is being sent.
- Command - Supplies the generic netlink control command to be sent.
- Group - Supplies an optional pointers to the multicast group that has
- just arrived or is being deleted.
- Return Value:
- Status code.
- --*/
- PNETLINK_GENERIC_FAMILY
- NetlinkpGenericLookupFamilyById (
- ULONG FamilyId
- );
- /*++
- Routine Description:
- This routine searches the database of registered generic netlink families
- for one with the given ID. If successful, the family is returned with an
- added reference which the caller must release.
- Arguments:
- FamilyId - Supplies the ID of the desired family.
- Return Value:
- Returns a pointer to the generic netlink family on success or NULL on
- failure.
- --*/
- PNETLINK_GENERIC_FAMILY
- NetlinkpGenericLookupFamilyByName (
- PSTR FamilyName
- );
- /*++
- Routine Description:
- This routine searches the database of registered generic netlink families
- for one with the given name. If successful, the family is returned with an
- added reference which the caller must release.
- Arguments:
- FamilyName - Supplies the name of the desired family.
- Return Value:
- Returns a pointer to the generic netlink family on success or NULL on
- failure.
- --*/
- VOID
- NetlinkpGenericFamilyAddReference (
- PNETLINK_GENERIC_FAMILY Family
- );
- /*++
- Routine Description:
- This routine increments the reference count of a generic netlink family.
- Arguments:
- Family - Supplies a pointer to a generic netlink family.
- Return Value:
- None.
- --*/
- VOID
- NetlinkpGenericFamilyReleaseReference (
- PNETLINK_GENERIC_FAMILY Family
- );
- /*++
- Routine Description:
- This routine decrements the reference count of a generic netlink family,
- releasing all of its resources if the reference count drops to zero.
- Arguments:
- Family - Supplies a pointer to a generic netlink family.
- Return Value:
- None.
- --*/
|