00001 #ifndef _GPXE_INTERFACE_H 00002 #define _GPXE_INTERFACE_H 00003 00004 /** @file 00005 * 00006 * Object communication interfaces 00007 * 00008 */ 00009 00010 FILE_LICENCE ( GPL2_OR_LATER ); 00011 00012 #include <gpxe/refcnt.h> 00013 00014 /** An object communication interface */ 00015 struct interface { 00016 /** Destination interface 00017 * 00018 * When messages are sent via this interface, they will be 00019 * delivered to the destination interface. 00020 * 00021 * This pointer may never be NULL. When the interface is 00022 * unplugged, it should point to a null interface. 00023 */ 00024 struct interface *dest; 00025 /** Reference counter 00026 * 00027 * If this interface is not part of a reference-counted 00028 * object, this field may be NULL. 00029 */ 00030 struct refcnt *refcnt; 00031 }; 00032 00033 /** 00034 * Increment reference count on an interface 00035 * 00036 * @v intf Interface 00037 * @ret intf Interface 00038 */ 00039 static inline __attribute__ (( always_inline )) struct interface * 00040 intf_get ( struct interface *intf ) { 00041 ref_get ( intf->refcnt ); 00042 return intf; 00043 } 00044 00045 /** 00046 * Decrement reference count on an interface 00047 * 00048 * @v intf Interface 00049 */ 00050 static inline __attribute__ (( always_inline )) void 00051 intf_put ( struct interface *intf ) { 00052 ref_put ( intf->refcnt ); 00053 } 00054 00055 extern void plug ( struct interface *intf, struct interface *dest ); 00056 extern void plug_plug ( struct interface *a, struct interface *b ); 00057 00058 #endif /* _GPXE_INTERFACE_H */
1.5.7.1