You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

interface.h 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef _GPXE_INTERFACE_H
  2. #define _GPXE_INTERFACE_H
  3. /** @file
  4. *
  5. * Object communication interfaces
  6. *
  7. */
  8. #include <gpxe/refcnt.h>
  9. /** An object communication interface */
  10. struct interface {
  11. /** Destination interface
  12. *
  13. * When messages are sent via this interface, they will be
  14. * delivered to the destination interface.
  15. *
  16. * This pointer may never be NULL. When the interface is
  17. * unplugged, it should point to a null interface.
  18. */
  19. struct interface *dest;
  20. /** Reference counter
  21. *
  22. * If this interface is not part of a reference-counted
  23. * object, this field may be NULL.
  24. */
  25. struct refcnt *refcnt;
  26. };
  27. /**
  28. * Increment reference count on an interface
  29. *
  30. * @v intf Interface
  31. * @ret intf Interface
  32. */
  33. static inline __attribute__ (( always_inline )) struct interface *
  34. intf_get ( struct interface *intf ) {
  35. ref_get ( intf->refcnt );
  36. return intf;
  37. }
  38. /**
  39. * Decrement reference count on an interface
  40. *
  41. * @v intf Interface
  42. */
  43. static inline __attribute__ (( always_inline )) void
  44. intf_put ( struct interface *intf ) {
  45. ref_put ( intf->refcnt );
  46. }
  47. extern void plug ( struct interface *intf, struct interface *dest );
  48. extern void plug_plug ( struct interface *a, struct interface *b );
  49. #endif /* _GPXE_INTERFACE_H */