OCB access from custom message handler?

I’m working on porting a QNX 4 application to QNX 6.2.1. I’m using the
resource manager library, but am attempting to keep the bulk of the code
as similar as possible to QNX 4. I’m using message_attach() to set up
my own handler function for various custom messages. From within the
message handling function, is it possible to get access to the OCB for
the current client? Thanks.

Josh Hamacher
FAAC Incorporated

Josh Hamacher <jh@faac.com> wrote:

I’m working on porting a QNX 4 application to QNX 6.2.1. I’m using the
resource manager library, but am attempting to keep the bulk of the code
as similar as possible to QNX 4. I’m using message_attach() to set up
my own handler function for various custom messages. From within the
message handling function, is it possible to get access to the OCB for
the current client? Thanks.

No, it isn’t (without a lot of grubbing).

Instead, in the iofuncs callouts, have a callout of type msg:

resgmr_iofuncs_t iofuncs;
iofunc_func_init( … &iofuncs );
iofuncs.msg = my_msg_handler)

Then, the messages sent to your resmgr with a type of _IO_MSG will
end up in that handler, after all the OCB decode work has been done
for you.

On the client side:

typedef struct {
struct _io_msg hdr;
/* your stuff here */
} my_io_msg_text_t;

msg.hdr.type = _IO_MSG;
msg.hdr.combine_len = sizeof(msg.hdr);
msg.hdr.mgrid = _IOMGR_PRIVATE_BASE + something;
msg.hdr.subtype = whatever_you_want;
/* fill in other stuff… */

MsgSend(fd, &msg, … );

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Okay, thanks.

Josh Hamacher
FAAC Incorporated



David Gibbs wrote:

Josh Hamacher <> jh@faac.com> > wrote:

I’m working on porting a QNX 4 application to QNX 6.2.1. I’m using the
resource manager library, but am attempting to keep the bulk of the code
as similar as possible to QNX 4. I’m using message_attach() to set up
my own handler function for various custom messages. From within the
message handling function, is it possible to get access to the OCB for
the current client? Thanks.


No, it isn’t (without a lot of grubbing).

Instead, in the iofuncs callouts, have a callout of type msg:

resgmr_iofuncs_t iofuncs;
iofunc_func_init( … &iofuncs );
iofuncs.msg = my_msg_handler)

Then, the messages sent to your resmgr with a type of _IO_MSG will
end up in that handler, after all the OCB decode work has been done
for you.

On the client side:

typedef struct {
struct _io_msg hdr;
/* your stuff here */
} my_io_msg_text_t;

msg.hdr.type = _IO_MSG;
msg.hdr.combine_len = sizeof(msg.hdr);
msg.hdr.mgrid = _IOMGR_PRIVATE_BASE + something;
msg.hdr.subtype = whatever_you_want;
/* fill in other stuff… */

MsgSend(fd, &msg, … );

-David