# with (Port with translation capabilitiy)

The function identifyer after the with keyword specifies the translation function which converts the types of the inner and outer ports.

Related keywords:

- port
- map to

### type port PortTypeId message [ map to { OuterPortType [ "," ] }+ ] { ( in { InnerInType [ from { OuterInType with InFunction "(" ")" [ "," ] }+ ] [ "," ] }+ | out { InnerOutType [ to { OuterOutType with OutFunction "(" ")" [ "," ]}+ ] [ "," ] }+ | inout { InOutType [ "," ] }+ | address AddrType [ to { OuterAddrTypewith AddrOutFunction "(" ")" [ "," ] }+ ] }

- the InFunction will convert the outgoing InnerOutType to OuterOutType before sending it out on the OuterPortType

- the InFunction will convert the incoming OuterInType to InnerInType after receiving it on the OuterPortType

Example:

type port OneM2MPort message map to IPL4asp_PT { out MsgOut to ASP_Send with f_enc_M2MPrimitive_to_ASPSend() in MsgIn from ASP_RecvFrom with f_dec_ASPRecvFrom_to_M2MPrimitive(), ASP_Event }

If a MsgOut type message is being sent on the OneM2MPort it will automatically be translated to ASP_Send type to be sent out on the IPL4 port using f_enc_M2MPrimitive_to_ASPSend function. The same applies in the incoming direction: if an ASP_RecvFrom type message is received on the IPL4asp_PT the f_dec_ASPRecvFrom_to_M2MPrimitive function will convert it to MsgIn type. In this example ASP_Event is an incoming type, which will be received in OneM2MPort unconverted, as it has no conversion function specified in this mapping.

BNF definition of with (PWTC)