public:
virtual bool clearBytes();
Clear the entire data buffer by calling bzero().
Result: true if the buffer was cleared, false otherwise.public:
virtual bool copyBytes(void * bytes, UInt * inOutLength) const;
Copy the data buffer to a destination buffer provided by the caller.
Result: true if the destination buffer is larger or equal to the length of the parameter, false otherwise.
Name Description bytes Pointer to a destination buffer. inOutLength The caller must initialize the integer value pointed by inOutLength with the size of the destination buffer, and this method will overwrite it with the number of bytes copied.
protected:
virtual void free();
Frees the IONetworkParameter instance.
public:
virtual UInt32 getAccessTypes() const;
Result: The access types supported by this instance.
public:
virtual IONPAction getAction() const;
Result: The notification action.
public:
virtual void * getArgument() const;
Result: The notification argument.
public:
virtual const void * getBuffer() const;
Result: A pointer to the data buffer.
public:
virtual UInt getCapacity() const;
Override the getCapacity() method inherited from OSData.
Result: The capacity of the data buffer in bytes.public:
virtual void getDescriptor(IONPDescriptor * descP) const;
Updates the IONPDescriptor structure provided by the caller.
Name Description Pointer to an IONPDescriptor structure allocated by the caller.
public:
virtual const OSSymbol * getKey() const;
During initialization, IONetworkParameter will create an OSSymbol key based on its assigned name. This key can be used when adding this object to a dictionary.
Result: An OSSymbol key based on the parameter's assigned name.public:
virtual OSObject * getTarget() const;
Result: The notification target.
public:
virtual bool initWithName(const char * name, void * buffer, UInt32 size, UInt32 accessTypes = kIONPAccessRead, OSObject * target = 0, IONPAction action = 0, void * arg = 0);
Initialize an IONetworkParameter instance. A target/action may be assigned to receive notifications when the read(), write(), or reset() methods are called. See those methods for additional information.
Result: true if initialized successfully, false otherwise.
Name Description name A name assigned to the parameter. buffer Points to an external data buffer. If set to kIONPInternalBuffer, then internal buffer storage shall be allocated. size Size of the data buffer in bytes. Both the capacity and the length are intialized to the size given. accessTypes The types of access allowed. Can be later changed by calling setAccessTypes(). target Notification target. action Notification action. arg Notification argument.
protected:
static void initialize();
Class initializer which allocates a global mutex lock (gIONPLock).
public:
virtual IOReturn read(void * inBuffer, UInt * inOutSize);
Handle a request to read from the data buffer and copy it to the destination buffer provided. If notification is enabled, then the notification handler is called with the access argument set to kIONPAccessRead before the data buffer is copied to the destination buffer. The notification handler may take this opportunity to update the contents of the data buffer.
Result: kIOReturnSuccess if success, kIOReturnBadArgument if any argument is invalid, kIOReturnNoSpace if the destination buffer is too small, kIOReturnNotReadable if read access is not permitted, or some other error code from the notification handler if called.
Name Description inBuffer Pointer to the destination buffer. inOutSize Points to the size of the destination buffer before the call. This method will change it to contain the actual number of bytes written to the destination buffer.
public:
virtual IOReturn reset();
Handle a request to reset the parameter. If notication is enabled, then the notification handler is called with the access argument set to kIONPAccessReset, after the data buffer is cleared.
Result: kIOReturnNotWritable if reset access is not allowed, or kIOReturnSuccess otherwise. If a notification handler is called, then the return value from the handler is returned.public:
virtual bool serialize(OSSerialize * s) const;
Serialize the parameter object. If notification is enabled, then the notification target is called as though a read() access has occurred.
Name Description s An OSSerialize object.
public:
virtual void setAccessTypes(UInt32 accessTypes);
Sets the types of external access allowed. For instance, if access is set to kIONPAccessRead, then only read() will return success. Calls to write() or reset() will return kIOReturnNotWritable. To change this and allow writes, access must be set to (kIONPAccessRead | kIONPAccessWrite). Note that other methods in IONetworkParameter do not check the access types.
Name Description accessTypes All supported access types.
public:
virtual bool setBytes(const void * bytes, UInt inLength);
Replace the data buffer contents from a source buffer provided by the caller.
Result: true if the length of the source buffer is valid, and the source buffer was copied, false otherwise.
Name Description bytes Pointer to a source buffer provided by the caller. inLength Length of the source buffer. The length provided must be smaller or equal to the capacity of the parameter object.
public:
virtual bool setLength(UInt inLength);
Set a new data buffer length.
Result: true if the length provided was accepted.
Name Description inLength Length of the data buffer in bytes. The length provided must be smaller or equal to the capacity of the parameter object.
public:
virtual void setNotificationTarget(OSObject * target, IONPAction action, void * arg = 0);
Set a target/action to receive external access notifications.
Name Description target The target object. If set to 0, then notification will be disabled. action The notification action or handler. If set to 0, then notification will be disabled. arg An optional argument that will be passed to the notification handler.
public:
static IONetworkParameter * withName( const char * name, void * buffer, UInt32 size, UInt32 accessTypes = kIONPAccessRead, OSObject * target = 0, IONPAction action = 0, void * arg = 0);
Factory method that will construct and initialize an IONetworkParameter instance.
Result: An IONetworkParameter instance upon success, or 0 otherwise.
Name Description name Same as init(). buffer Same as init(). size Same as init(). accessTypes Same as init(). target Same as init(). action Same as init(). arg Same as init().
public:
virtual IOReturn write(void * inBuffer, UInt size);
Handle a request to write to the data buffer from a source buffer provided. If notification is enabled, then the notification handler is called with the access argument set to kIONPAccessWrite after the source buffer has been copied to the data buffer.
Result: kIOReturnSuccess if success, kIOReturnBadArgument if any argument is invalid, kIOReturnNoSpace if the source buffer is too big, kIOReturnNotWritable if write access is not permitted, or some other error code from the notification handler if called.
Name Description inBuffer Pointer to the source buffer. size Size of the source buffer in bytes.
© 2000 Apple Computer, Inc. (Last Updated 2/23/2000)