News:

We really need your input in this questionnaire

Main Menu

DCI modification using protocol

Started by Mongi, October 11, 2010, 09:28:26 PM

Previous topic - Next topic

Mongi

Hello.

I'm writing my own client to connect and operate with NetXMS using it's protocol. It was quite successful until I faced creation of DCI's.

The problem is that to create DCI of an object, you need to create DCI(you get just new ID) and then modify it's content. When I tried to modify it, I've go error RCC_OUT_OF_STATE_REQUEST. According to session.cpp and ClientSession::ModifyNodeDCI I need to lock the object DCI list somehow. Some hard search resulted the only command able to lock this DCI list of object is CMD_GET_NODE_DCI_LIST(and CMD_UNLOCK_NODE_DCI_LIST to unlock). But it has two disadvantages:
1) It gives you all of DCI within selected object
2) This list of DCI doesn't finish with any "LIST_END" command, like object list is closed by CMD_OBJECT_LIST_END. So, we have to wait for a timeout in order to figure out that server finished list sending. (Moreover, there is command CMD_NODE_DCI_LIST_END in protocol reference but it's totally missing in source code :-\ )

So, is there more straightforward way to create/modify new DCI without waiting for full DCI list (or without this list at all)?

If it's the only way for now, could you please implement some possibility in protocol to simply lock and unlock object DCI list for current session?

Victor Kirhenshtein

Hi!

Currently, the only way to lock node's DCI list is to issue CMD_GET_NODE_DCI_LIST, because when I was writing this, I was thinking only about GUI client, which usually need to display current DCI list immediately. Our current intention is to remove all exclusive locks for configuration and replace it with change notifications - this is already done for some parts of server configuration, like use management. Why receiving full DCI list is a problem? You can just ignore it if you don't need it. And for end of list - you don't have to wait a timeout to detect a list end - each NXCP message has a flags field, and in many list responses flag "END OF SEQUENCE" (0x0008) is used to indicate end of list. In case of DCI list, at the end you will get empty message with this flag set.

Best regards,
Victor

Mongi

Receiving full list is not a problem unless there are some "end of list" marker. I was confused with CMD_OBJECT_LIST_END and expected to find something similar about node list. Thanks for the tip with "END OF SEQUENCE" flag, seems to work now.

Does all lists sent by server ends with "END OF SEQUENCE" flag or there are exceptions?

Victor Kirhenshtein

Currently it's a mix. End of sequence flag was introduced later during protocol development, so some lists uses special message, and some uses this flag.

Best regards,
Victor