1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /********************************************************************20**
25 Desc: This file contains the packing/unpacking functions
26 for the H.225 primitives on hct interface
30 *********************************************************************21*/
32 /* header include files (.h) */
34 #include "envopt.h" /* environment options */
35 #include "envdep.h" /* environment dependent */
36 #include "envind.h" /* environment independent */
38 #include "gen.h" /* general layer */
39 #include "ssi.h" /* system service interface */
43 /* header/extern include files (.x) */
45 #include "gen.x" /* general layer */
46 #include "ssi.x" /* system service interface */
48 /*#include "cm_tkns.x"*/
58 /* forward references */
60 /* local function definition */
62 /* functions in other modules */
64 /* public variable declarations */
66 /* control variables for testing */
68 /* private variable declarations */
74 /* cm_tpt_c_001.main_17 - Guarded under LCEGT and LCLEG */
75 /* cm_tpt_c_001.main_18 - Guarded under LWLCEGT */
77 #if ( defined(LCHCT) || defined (LWLCHCT) || defined(LCHIT) \
78 || defined(LCLHC) || defined(TRIL_HZ) \
79 || defined(LCHRT) || defined(LCLHR) \
80 || defined(LCLMG) || defined(LCMGT) \
81 || defined(LCLHG) || defined(LCHGT) \
82 || defined(LCSCT) || defined(LCLSB) \
83 || defined(LCLNT) || defined(LCLLN) \
84 || defined(LCLSO) || defined(LCSOT) \
85 || defined(LCEGT) || defined(LCLEG) || defined(LWLCEGT) \
86 || defined(CM_COMPRESS) \
92 /* Add prototypes here (MB) */
103 /* Moving IPv4 address packing functions from cm_inet.c */
106 * Fun: cmPkCmIpv4TptAddr
108 * Desc: This function packs the IPv4 address
118 PUBLIC S16 cmPkCmIpv4TptAddr
120 CmIpv4TptAddr *pkParam, /* IPv4 Address structure */
121 Buffer *mBuf /* message buffer */
124 PUBLIC S16 cmPkCmIpv4TptAddr (pkParam, mBuf)
125 CmIpv4TptAddr *pkParam; /* IPv4 Address structure */
126 Buffer *mBuf; /* message buffer */
129 TRC2(cmPkCmIpv4TptAddr)
131 CMCHKPK(cmPkCmIpv4NetAddr, pkParam->address, mBuf);
132 CMCHKPK(SPkU16, pkParam->port, mBuf);
135 } /* cmPkCmIpv4TptAddr */
139 * Fun: cmPkCmIpv6NetAddr
141 * Desc: This function packs the 16 bytes of IPv6 address
151 PRIVATE S16 cmPkCmIpv6NetAddr
153 CmIpv6NetAddr *pkParam,
154 Buffer *mBuf /* message buffer */
157 PRIVATE S16 cmPkCmIpv6NetAddr (pkParam, mBuf)
158 CmIpv6NetAddr *pkParam;
159 Buffer *mBuf; /* message buffer */
163 U8 *ptr = (U8*)pkParam;
165 TRC3(cmPkCmIpv6NetAddr)
167 for(num = 0; num < CM_IPV6ADDR_SIZE; num++)
169 CMCHKPK(SPkU8, *(ptr+num), mBuf);
173 } /* end of cmPkCmIpv6NetAddr */
178 * Fun: cmPkCmIpv6TptAddr
180 * Desc: This function packs the IPv6 transport address
190 PRIVATE S16 cmPkCmIpv6TptAddr
192 CmIpv6TptAddr *pkParam, /* IPv6 transport address */
193 Buffer *mBuf /* message buffer */
196 PRIVATE S16 cmPkCmIpv6TptAddr (pkParam, mBuf)
197 CmIpv6TptAddr *pkParam; /* IPv6 transport address */
198 Buffer *mBuf; /* message buffer */
201 TRC3(cmPkCmIpv6TptAddr)
203 CMCHKPK(cmPkCmIpv6NetAddr, &pkParam->ipv6NetAddr, mBuf);
204 CMCHKPK(SPkU16, pkParam->port, mBuf);
207 } /* cmPkCmIpv6TptAddr */
212 * Fun: cmPkCmNetAddrTbl
214 * Desc: This function packs the
224 PUBLIC S16 cmPkCmNetAddrTbl
226 CmNetAddrTbl *pkParam, /* Network Address Table */
227 Buffer *mBuf /* message buffer */
230 PUBLIC S16 cmPkCmNetAddrTbl (pkParam, mBuf)
231 CmNetAddrTbl *pkParam; /* Network Address Table */
232 Buffer *mBuf; /* message buffer */
235 U16 idx; /* Loop Index */
236 CmNetAddr *netAddr; /* Network Address */
238 TRC2(cmPkCmNetAddrTbl)
240 if (pkParam->count > CM_MAX_NET_ADDR)
243 /* Pack All the addresses */
244 for (idx = pkParam->count; idx; idx--)
246 netAddr = &(pkParam->netAddr[idx - 1]);
248 if ((cmPkCmNetAddr(netAddr, mBuf)) != ROK)
252 /* Pack the total number of addresses present in the table */
253 CMCHKPK(SPkU16, pkParam->count, mBuf);
257 } /* end of cmPkCmNetAddrTbl() */
263 * Desc: This function packs the
273 PUBLIC S16 cmPkCmNetAddr
276 Buffer *mBuf /* message buffer */
279 PUBLIC S16 cmPkCmNetAddr (pkParam, mBuf)
281 Buffer *mBuf; /* message buffer */
286 switch (pkParam->type)
288 case CM_NETADDR_NOTPRSNT:
291 case CM_NETADDR_IPV4:
292 CMCHKPK(cmPkCmIpv4NetAddr, pkParam->u.ipv4NetAddr, mBuf);
295 case CM_NETADDR_IPV6:
296 CMCHKPK(cmPkCmIpv6NetAddr, &pkParam->u.ipv6NetAddr, mBuf);
302 CMCHKPK(SPkU8, pkParam->type, mBuf);
305 } /* cmPkCmNetAddr */
312 * Desc: This function packs the
322 PUBLIC S16 cmPkCmTptAddr
325 Buffer *mBuf /* message buffer */
328 PUBLIC S16 cmPkCmTptAddr (pkParam, mBuf)
330 Buffer *mBuf; /* message buffer */
335 switch (pkParam->type)
337 case CM_TPTADDR_NOTPRSNT:
340 case CM_TPTADDR_IPV4:
341 CMCHKPK(cmPkCmIpv4TptAddr, &pkParam->u.ipv4TptAddr, mBuf);
344 case CM_TPTADDR_IPV6:
345 CMCHKPK(cmPkCmIpv6TptAddr, &pkParam->u.ipv6TptAddr, mBuf);
351 CMCHKPK(SPkU8, pkParam->type, mBuf);
354 } /* cmPkCmTptAddr */
356 /* added new packing functions */
360 * Fun: cmPkCmTptLocalInf
362 * Desc: This function packs the local interface info on which IPV4/IPV6
363 * packet was received on.
373 PUBLIC S16 cmPkCmTptLocalInf
375 CmTptLocalInf *pkParam, /* local interface info */
376 Buffer *mBuf /* message buffer */
379 PUBLIC S16 cmPkCmTptLocalInf (pkParam, mBuf)
380 CmTptLocalInf *pkParam; /* local interface info */
381 Buffer *mBuf; /* message buffer */
384 TRC3(cmPkCmTptLocalInf)
386 if (pkParam->intfPrsnt == TRUE)
388 /* pack the actual interface address */
389 CMCHKPK(cmPkCmNetAddr, &pkParam->localIfAddr, mBuf);
390 /* pack the interface index value */
391 CMCHKPK(SPkU32, pkParam->localIf, mBuf);
393 /* pack the boll which indicates if valid local intf is present or not */
394 CMCHKPK(SPkU8, pkParam->intfPrsnt, mBuf);
396 } /* cmPkCmTptLocalInf */
397 #endif /* LOCAL_INTF */
399 /* Moving IPv6 multicast information packing functions from cm_inet.c */
400 #ifdef IPV6_SUPPORTED
403 * Fun: cmPkCmNetMCastInf6
405 * Desc: This function packs the IPv6 multicast information
415 PUBLIC S16 cmPkCmNetMCastInf6
417 CmNetMCastInf6 *pkParam, /* IPv6 multicast information */
418 Buffer *mBuf /* message buffer */
421 PUBLIC S16 cmPkCmNetMCastInf6(pkParam, mBuf)
422 CmNetMCastInf6 *pkParam; /* IPv6 multicast information */
423 Buffer *mBuf; /* message buffer */
426 TRC3(cmPkCmNetMCastInf6)
428 CMCHKPK(cmPkCmIpv6NetAddr, &pkParam->mCastAddr, mBuf);
429 CMCHKPK(SPkU32, pkParam->localInf, mBuf);
432 } /* cmPkCmNetMCastInf6 */
433 #endif /* IPV6_SUPPORTED */
438 * Fun: cmPkCmSockOpts
440 * Desc: This function packs the
450 PRIVATE S16 cmPkCmSockOpts
453 Buffer *mBuf /* message buffer */
456 PRIVATE S16 cmPkCmSockOpts (pkParam, mBuf)
458 Buffer *mBuf; /* message buffer */
463 switch (pkParam->option)
465 case CM_SOCKOPT_OPT_ADD_MCAST_MBR:
466 case CM_SOCKOPT_OPT_DRP_MCAST_MBR:
468 CMCHKPK(cmPkCmNetAddr, &pkParam->optVal.mCastInfo.mCastAddr, mBuf);
469 CMCHKPK(cmPkCmNetAddr, &pkParam->optVal.mCastInfo.localAddr, mBuf);
471 CMCHKPK(cmPkCmNetAddr, &pkParam->optVal.mCastAddr, mBuf);
472 #endif /* CM_INET2 */
475 case CM_SOCKOPT_OPT_MCAST_IF:
476 CMCHKPK(cmPkCmNetAddr, &pkParam->optVal.lclAddr, mBuf);
479 #ifdef IPV6_SUPPORTED
480 case CM_SOCKOPT_OPT_ADD_MCAST6_MBR:
481 case CM_SOCKOPT_OPT_DRP_MCAST6_MBR:
482 CMCHKPK(cmPkCmNetMCastInf6, &pkParam->optVal.mCastInfo6, mBuf);
485 case CM_SOCKOPT_OPT_MCAST6_IF:
486 CMCHKPK(SPkU32, pkParam->optVal.infId, mBuf);
489 #endif /* IPV6_SUPPORTED */
492 CMCHKPK(SPkU32, pkParam->optVal.value, mBuf);
495 CMCHKPK(SPkU32, pkParam->option, mBuf);
496 CMCHKPK(SPkU32, pkParam->level, mBuf);
499 } /* cmPkCmSockOpts */
504 * Fun: cmPkCmSockParam
506 * Desc: This function packs the
516 PRIVATE S16 cmPkCmSockParam
518 CmSockParam *pkParam,
519 Buffer *mBuf /* message buffer */
522 PRIVATE S16 cmPkCmSockParam (pkParam, mBuf)
523 CmSockParam *pkParam;
524 Buffer *mBuf; /* message buffer */
529 TRC3(cmPkCmSockParam)
531 if( pkParam->numOpts > CM_MAX_SOCK_OPTS)
535 for(num = 0; num < pkParam->numOpts; num++)
537 CMCHKPK(cmPkCmSockOpts, &pkParam->sockOpts[num], mBuf);
539 CMCHKPK(SPkU8, pkParam->numOpts, mBuf);
540 CMCHKPK(SPkU8, pkParam->listenQSize, mBuf);
543 } /* cmPkCmSockParam */
549 * Fun: cmPkTlsTptParam
551 * Desc: This function packs the
561 PRIVATE S16 cmPkTlsTptParam
563 TlsTptParam *pkParam, /**/
564 Buffer *mBuf /* message buffer */
567 PRIVATE S16 cmPkTlsTptParam(pkParam, mBuf)
568 TlsTptParam *pkParam; /**/
569 Buffer *mBuf; /* message buffer */
574 TRC3(cmPkTlsTptParam)
576 if( pkParam->numOpts > CM_MAX_SOCK_OPTS)
580 for(num = 0; num < pkParam->numOpts; num++)
582 CMCHKPK(cmPkCmSockOpts, &pkParam->sockOpts[num], mBuf);
584 CMCHKPK(SPkU8, pkParam->numOpts, mBuf);
585 CMCHKPK(SPkU8, pkParam->listenQSize, mBuf);
586 CMCHKPK(SPkS16, pkParam->ctxId, mBuf);
589 } /* cmPkTlsTptParam */
596 * Fun: cmPkCmTptParam
598 * Desc: This function packs the
608 PUBLIC S16 cmPkCmTptParam
611 Buffer *mBuf /* message buffer */
614 PUBLIC S16 cmPkCmTptParam (pkParam, mBuf)
616 Buffer *mBuf; /* message buffer */
621 switch (pkParam->type)
623 case CM_TPTPARAM_NOTPRSNT:
626 case CM_TPTPARAM_SOCK:
627 CMCHKPK(cmPkCmSockParam, &pkParam->u.sockParam, mBuf);
631 case CM_TPTPARAM_AAL:
632 CMCHKPK(cmPkAalConParam, &pkParam->u.aalParam, mBuf);
637 case CM_TPTPARAM_TLS:
638 CMCHKPK(cmPkTlsTptParam, &pkParam->u.tlsParam, mBuf);
646 CMCHKPK(SPkU8, pkParam->type, mBuf);
649 } /* cmPkCmTptParam */
653 * UNPACKING FUNCTIONS
656 /* Moving IPv4 address un-packing functions from cm_inet.c file */
660 * Fun: cmUnpkCmIpv4TptAddr
662 * Desc: This function unpacks the IPv4 address
672 PUBLIC S16 cmUnpkCmIpv4TptAddr
674 CmIpv4TptAddr *unpkParam, /* IPv4 Address */
675 Buffer *mBuf /* message buffer */
678 PUBLIC S16 cmUnpkCmIpv4TptAddr (unpkParam, mBuf)
679 CmIpv4TptAddr *unpkParam; /* IPv4 Address */
680 Buffer *mBuf; /* message buffer */
683 TRC2(cmUnpkCmIpv4TptAddr)
685 CMCHKUNPK(SUnpkU16, &unpkParam->port, mBuf);
686 CMCHKUNPK(cmUnpkCmIpv4NetAddr, &unpkParam->address, mBuf);
689 } /* cmUnpkCmIpv4TptAddr */
694 * Fun: cmUnpkCmIpv6NetAddr
696 * Desc: This function unpacks the 16 bytes of IPv6 address
706 PRIVATE S16 cmUnpkCmIpv6NetAddr
708 CmIpv6NetAddr *unpkParam, /* IPv6 address */
709 Buffer *mBuf /* message buffer */
712 PRIVATE S16 cmUnpkCmIpv6NetAddr (unpkParam, mBuf)
713 CmIpv6NetAddr *unpkParam; /* IPv6 address */
714 Buffer *mBuf; /* message buffer */
718 U8 *ptr = (U8*)unpkParam;
720 TRC3(cmUnpkCmIpv6NetAddr)
722 ptr += (CM_INET_IPV6ADDR_SIZE - 1);
724 for(num = 0; num < CM_IPV6ADDR_SIZE; num++)
726 CMCHKUNPK(SUnpkU8, (ptr-num), mBuf);
730 } /* end of cmUnpkCmIpv6NetAddr */
735 * Fun: cmUnpkCmIpv6TptAddr
737 * Desc: This function unpacks the IPv6 transport address
747 PRIVATE S16 cmUnpkCmIpv6TptAddr
749 CmIpv6TptAddr *unpkParam, /* IPv6 transport address */
750 Buffer *mBuf /* message buffer */
753 PRIVATE S16 cmUnpkCmIpv6TptAddr (unpkParam, mBuf)
754 CmIpv6TptAddr *unpkParam; /* IPv6 transport address */
755 Buffer *mBuf; /* message buffer */
758 TRC3(cmUnpkCmIpv6TptAddr)
760 CMCHKUNPK(SUnpkU16, &unpkParam->port, mBuf);
761 CMCHKUNPK(cmUnpkCmIpv6NetAddr, &unpkParam->ipv6NetAddr, mBuf);
764 } /* cmUnpkCmIpv6TptAddr */
769 * Fun: cmUnpkCmNetAddrTbl
771 * Desc: This function unpacks the
781 PUBLIC S16 cmUnpkCmNetAddrTbl
783 CmNetAddrTbl *unpkParam, /* Network Address Table */
784 Buffer *mBuf /* message buffer */
787 PUBLIC S16 cmUnpkCmNetAddrTbl (unpkParam, mBuf )
788 CmNetAddrTbl *unpkParam; /* Network Address Table */
789 Buffer *mBuf; /* message buffer */
792 U16 idx; /* Loop Index */
793 CmNetAddr *netAddr; /* Network Address */
795 TRC2(cmUnpkCmNetAddrTbl)
797 /* Unpack the count */
798 CMCHKUNPK(SUnpkU16, &(unpkParam->count), mBuf);
800 /* Unpack the addresses */
801 for (idx = 0; idx < unpkParam->count; idx++)
803 netAddr = &(unpkParam->netAddr[idx]);
805 if ((cmUnpkCmNetAddr(netAddr, mBuf)) != ROK)
811 } /* end of cmUnpkCmNetAddrTbl() */
816 * Fun: cmUnpkCmNetAddr
818 * Desc: This function unpacks the network address
828 PUBLIC S16 cmUnpkCmNetAddr
830 CmNetAddr *unpkParam,
831 Buffer *mBuf /* message buffer */
834 PUBLIC S16 cmUnpkCmNetAddr (unpkParam, mBuf )
835 CmNetAddr *unpkParam;
836 Buffer *mBuf; /* message buffer */
839 TRC3(cmUnpkCmNetAddr)
841 CMCHKUNPK(SUnpkU8, &unpkParam->type, mBuf);
843 switch (unpkParam->type)
845 case CM_NETADDR_NOTPRSNT:
848 case CM_NETADDR_IPV4:
849 CMCHKUNPK(cmUnpkCmIpv4NetAddr, &unpkParam->u.ipv4NetAddr, mBuf);
852 case CM_NETADDR_IPV6:
853 CMCHKUNPK(cmUnpkCmIpv6NetAddr, &unpkParam->u.ipv6NetAddr, mBuf);
861 } /* cmUnpkCmNetAddr */
866 * Fun: cmUnpkCmTptAddr
868 * Desc: This function unpacks the
878 PUBLIC S16 cmUnpkCmTptAddr
880 CmTptAddr *unpkParam,
881 Buffer *mBuf /* message buffer */
884 PUBLIC S16 cmUnpkCmTptAddr (unpkParam, mBuf)
885 CmTptAddr *unpkParam;
886 Buffer *mBuf; /* message buffer */
889 TRC3(cmUnpkCmTptAddr)
891 CMCHKUNPK(SUnpkU8, &unpkParam->type, mBuf);
893 switch (unpkParam->type)
895 case CM_TPTADDR_NOTPRSNT:
898 case CM_TPTADDR_IPV4:
899 CMCHKUNPK(cmUnpkCmIpv4TptAddr, &unpkParam->u.ipv4TptAddr, mBuf);
902 case CM_TPTADDR_IPV6:
903 CMCHKUNPK(cmUnpkCmIpv6TptAddr, &unpkParam->u.ipv6TptAddr, mBuf);
911 } /* cmUnpkCmTptAddr */
913 /* Moving IPv6 multicast information unpacking functions from cm_inet.c */
914 #ifdef IPV6_SUPPORTED
918 * Fun: cmUnpkCmNetMCastInf6
920 * Desc: This function unpacks the IPv6 multicast information
930 PUBLIC S16 cmUnpkCmNetMCastInf6
932 CmNetMCastInf6 *unpkParam, /* IPv6 multicast information */
933 Buffer *mBuf /* message buffer */
936 PUBLIC S16 cmUnpkCmNetMCastInf6(unpkParam, mBuf)
937 CmNetMCastInf6 *unpkParam; /* IPv6 multicast information */
938 Buffer *mBuf; /* message buffer */
941 TRC3(cmUnpkCmNetMCastInf6)
943 CMCHKUNPK(SUnpkU32, &unpkParam->localInf, mBuf);
944 CMCHKUNPK(cmUnpkCmIpv6NetAddr, &unpkParam->mCastAddr, mBuf);
947 } /* cmUnpkCmNetMCastInf6 */
948 #endif /* IPV6_SUPPORTED */
953 * Fun: cmUnpkCmSockOpts
955 * Desc: This function unpacks the socket options
965 PRIVATE S16 cmUnpkCmSockOpts
967 CmSockOpts *unpkParam, /* socket options */
968 Buffer *mBuf /* message buffer */
971 PRIVATE S16 cmUnpkCmSockOpts (unpkParam, mBuf)
972 CmSockOpts *unpkParam; /* socket options */
973 Buffer *mBuf; /* message buffer */
976 TRC3(cmUnpkCmSockOpts)
978 CMCHKUNPK(SUnpkU32, &unpkParam->level, mBuf);
979 CMCHKUNPK(SUnpkU32, &unpkParam->option, mBuf);
981 switch (unpkParam->option)
983 case CM_SOCKOPT_OPT_ADD_MCAST_MBR:
984 case CM_SOCKOPT_OPT_DRP_MCAST_MBR:
986 CMCHKUNPK(cmUnpkCmNetAddr, &unpkParam->optVal.mCastInfo.localAddr,
988 CMCHKUNPK(cmUnpkCmNetAddr, &unpkParam->optVal.mCastInfo.mCastAddr,
991 CMCHKUNPK(cmUnpkCmNetAddr, &unpkParam->optVal.mCastAddr, mBuf);
992 #endif /* CM_INET2 */
995 case CM_SOCKOPT_OPT_MCAST_IF:
996 CMCHKUNPK(cmUnpkCmNetAddr, &unpkParam->optVal.lclAddr, mBuf);
999 #ifdef IPV6_SUPPORTED
1000 case CM_SOCKOPT_OPT_ADD_MCAST6_MBR:
1001 case CM_SOCKOPT_OPT_DRP_MCAST6_MBR:
1002 CMCHKUNPK(cmUnpkCmNetMCastInf6, &unpkParam->optVal.mCastInfo6, mBuf);
1005 case CM_SOCKOPT_OPT_MCAST6_IF:
1006 CMCHKUNPK(SUnpkU32, &unpkParam->optVal.infId, mBuf);
1008 #endif /* IPV6_SUPPORTED */
1011 CMCHKUNPK(SUnpkU32, &unpkParam->optVal.value, mBuf);
1016 } /* cmUnpkCmSockOpts */
1021 * Fun: cmUnpkCmSockParam
1023 * Desc: This function unpacks the socket parameters
1033 PRIVATE S16 cmUnpkCmSockParam
1035 CmSockParam *unpkParam, /* socket parameters */
1036 Buffer *mBuf /* message buffer */
1039 PRIVATE S16 cmUnpkCmSockParam (unpkParam, mBuf)
1040 CmSockParam *unpkParam; /* socket parameters */
1041 Buffer *mBuf; /* message buffer */
1046 TRC3(cmUnpkCmSockParam)
1048 CMCHKUNPK(SUnpkU8, &unpkParam->listenQSize, mBuf);
1049 CMCHKUNPK(SUnpkU8, &unpkParam->numOpts, mBuf);
1051 if( unpkParam->numOpts > CM_MAX_SOCK_OPTS)
1056 for(num = 0; num < unpkParam->numOpts; num++)
1058 CMCHKUNPK(cmUnpkCmSockOpts, &unpkParam->sockOpts[num], mBuf);
1062 } /* cmUnpkCmSockParam */
1068 * Fun: cmUnpkTlsTptParam
1070 * Desc: This function unpacks the socket parameters
1080 PRIVATE S16 cmUnpkTlsTptParam
1082 TlsTptParam *unpkParam, /* TLS parameters */
1083 Buffer *mBuf /* message buffer */
1086 PRIVATE S16 cmUnpkTlsTptParam (unpkParam, mBuf)
1087 TlsTptParam *unpkParam; /* TLS parameters */
1088 Buffer *mBuf; /* message buffer */
1093 TRC3(cmUnpkTlsTptParam)
1095 CMCHKUNPK(SUnpkS16, &unpkParam->ctxId, mBuf);
1096 CMCHKUNPK(SUnpkU8, &unpkParam->listenQSize, mBuf);
1097 CMCHKUNPK(SUnpkU8, &unpkParam->numOpts, mBuf);
1099 if( unpkParam->numOpts > CM_MAX_SOCK_OPTS)
1104 for(num = 0; num < unpkParam->numOpts; num++)
1106 CMCHKUNPK(cmUnpkCmSockOpts, &unpkParam->sockOpts[num], mBuf);
1110 } /* cmUnpkTlsTptParam */
1117 * Fun: cmUnpkCmTptParam
1119 * Desc: This function unpacks the transport parameters
1129 PUBLIC S16 cmUnpkCmTptParam
1131 CmTptParam *unpkParam, /* transport parameters */
1132 Buffer *mBuf /* message buffer */
1135 PUBLIC S16 cmUnpkCmTptParam (unpkParam, mBuf)
1136 CmTptParam *unpkParam; /* transport parameters */
1137 Buffer *mBuf; /* message buffer */
1140 TRC3(cmUnpkCmTptParam)
1142 CMCHKUNPK(SUnpkU8, &unpkParam->type, mBuf);
1144 switch (unpkParam->type)
1146 case CM_TPTPARAM_NOTPRSNT:
1149 case CM_TPTPARAM_SOCK:
1150 CMCHKUNPK(cmUnpkCmSockParam, &unpkParam->u.sockParam, mBuf);
1154 case CM_TPTPARAM_AAL:
1155 CMCHKUNPK(cmUnpkAalConParam, &unpkParam->u.aalParam, mBuf);
1160 case CM_TPTPARAM_TLS:
1161 CMCHKUNPK(cmUnpkTlsTptParam, &unpkParam->u.tlsParam, mBuf);
1170 } /* cmUnpkCmTptParam */
1177 * Fun: cmPkCmIpHdrParm
1179 * Desc: This function packs the the IP hedear parameters for both
1190 PUBLIC S16 cmPkCmIpHdrParm
1192 CmIpHdrParm *pkParam, /* IP hdr parameters */
1193 Buffer *mBuf /* message buffer */
1196 PUBLIC S16 cmPkCmIpHdrParm (pkParam, mBuf)
1197 CmIpHdrParm *pkParam; /* IP hdr parameters */
1198 Buffer *mBuf; /* message buffer */
1201 TRC3(cmPkCmIpHdrParm)
1203 switch (pkParam->type)
1205 case CM_HDRPARM_NOTPRSNT:
1206 case CM_HDRPARM_ICMP6:
1209 case CM_HDRPARM_IPV4:
1211 /* call to pack ipv4 options */
1212 #ifdef IPV4_OPTS_SUPPORTED
1213 /* ipv4 IP options */
1214 CMCHKPK(cmPkTknStr64, &pkParam->u.hdrParmIpv4.ipv4HdrOpt, mBuf);
1215 #endif /* IPV4_OPTS_SUPPORTED */
1217 CMCHKPK(cmPkTknU8, &pkParam->u.hdrParmIpv4.ttl, mBuf);
1218 CMCHKPK(cmPkTknU8, &pkParam->u.hdrParmIpv4.tos, mBuf);
1219 CMCHKPK(cmPkTknU8, &pkParam->u.hdrParmIpv4.dfBit, mBuf);
1220 CMCHKPK(cmPkTknU8, &pkParam->u.hdrParmIpv4.proto, mBuf);
1223 case CM_HDRPARM_IPV6:
1224 #ifdef IPV6_SUPPORTED
1225 /* call to pack ipv6 extn hdrs */
1226 #ifdef IPV6_OPTS_SUPPORTED
1227 /* pack IPV6 extension headers */
1228 CMCHKPK(cmPkCmIpv6ExtHdr, &pkParam->u.hdrParmIpv6.ipv6ExtHdr, mBuf);
1229 #endif /* IPV6_OPTS_SUPPORTED */
1230 CMCHKPK(cmPkCmNetAddr, &pkParam->u.hdrParmIpv6.srcAddr6, mBuf);
1231 CMCHKPK(cmPkTknU8, &pkParam->u.hdrParmIpv6.ttl, mBuf);
1232 #endif /* IPV6_SUPPORTED */
1238 CMCHKPK(SPkU8, pkParam->type, mBuf);
1241 } /* End of cmPkCmIpHdrParm */
1244 /* added new unpack function for local interface */
1248 * Fun: cmUnpkCmTptLocalInf
1250 * Desc: This function unpacks the local interface info on which
1251 * IPV4/IPV6 packet was received on.
1261 PUBLIC S16 cmUnpkCmTptLocalInf
1263 CmTptLocalInf *unpkParam, /* local interface info */
1264 Buffer *mBuf /* message buffer */
1267 PUBLIC S16 cmUnpkCmTptLocalInf (unpkParam, mBuf)
1268 CmTptLocalInf *unpkParam; /* local interface info */
1269 Buffer *mBuf; /* message buffer */
1272 TRC3(cmUnpkCmTptLocalInf)
1274 /* first unpack the bool intfPrsnt value which is always packed */
1275 CMCHKUNPK(cmUnpkBool, &unpkParam->intfPrsnt, mBuf);
1277 /* if the above unpacked bool is TRUE then we have to unpack further
1278 * to get the local intf index and intf address */
1279 if (unpkParam->intfPrsnt == TRUE)
1281 CMCHKUNPK(SUnpkU32, &unpkParam->localIf, mBuf);
1282 CMCHKUNPK(cmUnpkCmNetAddr, &unpkParam->localIfAddr, mBuf);
1285 } /* cmUnpkCmTptLocalInf */
1286 #endif /* LOCAL_INTF */
1289 /* added new functions */
1290 #ifdef IPV6_OPTS_SUPPORTED
1292 * Fun: cmPkCmIpv6ExtHdr
1294 * Desc: This function packs the IPV6 extension headers
1304 PUBLIC S16 cmPkCmIpv6ExtHdr
1306 CmIpv6ExtHdr *pkParam, /* IPV6 extension hdrs */
1307 Buffer *mBuf /* message buffer */
1310 PUBLIC S16 cmPkCmIpv6ExtHdr (pkParam, mBuf)
1311 CmIpv6ExtHdr *pkParam; /*IPV6 extension hdrs */
1312 Buffer *mBuf; /* message buffer */
1315 TRC3(cmPkCmIpv6ExtHdr)
1317 /* pack first Route hdr */
1318 if (pkParam->rtOptsPrsnt)
1319 CMCHKPK(cmPkCmIpv6RtHdr, &pkParam->rtOpts, mBuf);
1320 CMCHKPK(cmPkBool, pkParam->rtOptsPrsnt, mBuf);
1322 /* pack Dest Opt hdr */
1323 if (pkParam->destOptsPrsnt)
1324 CMCHKPK(cmPkCmIpv6DestOptsArr, &pkParam->destOptsArr, mBuf);
1325 CMCHKPK(cmPkBool, pkParam->destOptsPrsnt, mBuf);
1328 if (pkParam->hbhHdrPrsnt)
1329 CMCHKPK(cmPkCmIpv6HBHHdrArr, &pkParam->hbhOptsArr, mBuf);
1330 CMCHKPK(cmPkBool, pkParam->hbhHdrPrsnt, mBuf);
1333 } /* end of cmPkCmIpv6ExtHdr */
1338 * Fun: cmPkCmIpv6RtHdr
1340 * Desc: This function packs the IPV6 route header
1350 PUBLIC S16 cmPkCmIpv6RtHdr
1352 CmIpv6RtHdr *pkParam, /* IPV6 Route hdr */
1353 Buffer *mBuf /* message buffer */
1356 PUBLIC S16 cmPkCmIpv6RtHdr (pkParam, mBuf)
1357 CmIpv6RtHdr *pkParam; /* IPV6 Route hdr */
1358 Buffer *mBuf; /* message buffer */
1363 TRC3(cmPkCmIpv6RtHdr);
1365 /* pack all IPV6 addrs in the route hdr */
1366 for(idx = 0; idx < pkParam->numAddrs; idx++)
1368 CMCHKPK(cmPkCmIpv6NetAddr, &pkParam->ipv6Addrs[idx], mBuf);
1370 /* pack reserve byte & strict/loose bit map */
1371 CMCHKPK(SPkU32, pkParam->slMap, mBuf);
1372 CMCHKPK(SPkU8, pkParam->numAddrs, mBuf);
1375 } /* end of cmPkCmIpv6RtHdr */
1380 * Fun: cmUnpkCmIpv6RtHdr
1382 * Desc: This function unpacks the IPV6 route header
1385 * ROUTRES - out of resources
1393 PUBLIC S16 cmUnpkCmIpv6RtHdr
1395 CmIpv6RtHdr *unpkParam, /* IPV6 Route hdr */
1396 Buffer *mBuf, /* message buffer */
1397 Mem *memInfo /* meminfo to allocate for Route hdr */
1400 PUBLIC S16 cmUnpkCmIpv6RtHdr (unpkParam, mBuf, memInfo)
1401 CmIpv6RtHdr *unpkParam; /* IPV6 Route hdr */
1402 Buffer *mBuf; /* message buffer */
1403 Mem *memInfo; /* meminfo to allocate for Route hdr */
1406 U8 idx; /* array index */
1407 S32 retVal; /* temporary return value */
1409 TRC3(cmUnpkCmIpv6RtHdr);
1411 CMCHKUNPK(SUnpkU8, &unpkParam->numAddrs, mBuf);
1413 /* unpack reserve byte & strict/loose bit map */
1414 CMCHKUNPK(SUnpkU32, &unpkParam->slMap, mBuf);
1416 retVal = SGetSBuf(memInfo->region,
1418 (Data **)&unpkParam->ipv6Addrs,
1419 (unpkParam->numAddrs * 16));
1426 /* unpack all IPV6 addrs in the route hdr */
1427 for(idx = 0; idx < unpkParam->numAddrs; idx++)
1429 CMCHKUNPK(cmUnpkCmIpv6NetAddr, &unpkParam->ipv6Addrs[idx], mBuf);
1433 } /* end of cmUnpkCmIpv6RtHdr */
1438 * Fun: cmUnpkCmIpv6ExtHdr
1440 * Desc: This function unpacks the IPv6 extension header
1450 PUBLIC S16 cmUnpkCmIpv6ExtHdr
1452 CmIpv6ExtHdr *unpkParam, /* IPV6 extension hdrs */
1453 Buffer *mBuf, /* message buffer */
1454 Mem *memInfo /* meminfo to allocate for IPV6 ext hdr */
1457 PUBLIC S16 cmUnpkCmIpv6ExtHdr (unpkParam, mBuf, memInfo)
1458 CmIpv6ExtHdr *unpkParam; /* IPV6 extension hdrs */
1459 Buffer *mBuf; /* message buffer */
1460 Mem *memInfo; /* meminfo to allocate for IPV6 ext hdr */
1463 TRC3(cmUnpkCmIpv6ExtHdr)
1465 /* unpack HBH hdr first */
1466 CMCHKUNPK(cmUnpkBool, &unpkParam->hbhHdrPrsnt, mBuf);
1467 if (unpkParam->hbhHdrPrsnt)
1468 cmUnpkCmIpv6HBHHdrArr(&unpkParam->hbhOptsArr, mBuf, memInfo);
1470 /* unpack DEST opt hdr */
1471 CMCHKUNPK(cmUnpkBool, &unpkParam->destOptsPrsnt, mBuf);
1472 if (unpkParam->destOptsPrsnt)
1473 cmUnpkCmIpv6DestOptsArr(&unpkParam->destOptsArr, mBuf, memInfo);
1475 /* unpack Route hdr last */
1476 CMCHKUNPK(cmUnpkBool, &unpkParam->rtOptsPrsnt, mBuf);
1477 if (unpkParam->rtOptsPrsnt)
1478 cmUnpkCmIpv6RtHdr(&unpkParam->rtOpts, mBuf, memInfo);
1481 } /* end of cmUnpkCmIpv6ExtHdr */
1486 * Fun: cmPkCmIpv6DestOptsArr
1488 * Desc: This function packs the IPV6 Destination Option array
1498 PUBLIC S16 cmPkCmIpv6DestOptsArr
1500 CmIpv6DestOptsArr *pkParam, /* IPV6 Dest hdr array */
1501 Buffer *mBuf /* message buffer */
1504 PUBLIC S16 cmPkCmIpv6DestOptsArr (pkParam, mBuf)
1505 CmIpv6DestOptsArr *pkParam; /* IPV6 Dest hdr array */
1506 Buffer *mBuf; /* message buffer */
1512 TRC3(cmPkCmIpv6DestOptsArr);
1514 /* pack all HBH options */
1515 for(numOptions = 0; numOptions<pkParam->numDestOpts; numOptions++)
1516 CMCHKPK(cmPkCmIpv6DestOptsHdr, &pkParam->destOpts[numOptions], mBuf);
1517 CMCHKPK(SPkU8, pkParam->numDestOpts, mBuf);
1520 } /* end of cmPkCmIpv6DestOptsArr */
1525 * Fun: cmPkCmIpv6DestOptsHdr
1527 * Desc: This function packs individua IPV6 Destination Option
1537 PUBLIC S16 cmPkCmIpv6DestOptsHdr
1539 CmIpv6DestOptsHdr *pkParam, /* IPV6 Dest opt */
1540 Buffer *mBuf /* message buffer */
1543 PUBLIC S16 cmPkCmIpv6DestOptsHdr (pkParam, mBuf)
1544 CmIpv6DestOptsHdr *pkParam; /* IPV6 Dest opt */
1545 Buffer *mBuf; /* message buffer */
1550 TRC3(cmPkCmIpv6DestOptsHdr);
1552 for(optLen = 0; optLen < pkParam->length; optLen++)
1554 CMCHKPK(SPkU8, pkParam->value[optLen], mBuf);
1556 CMCHKPK(SPkU8, pkParam->length, mBuf);
1557 CMCHKPK(SPkU8, pkParam->type, mBuf);
1560 } /* end of cmPkCmIpv6DestOptsHdr */
1565 * Fun: cmUnpkCmIpv6DestOptsHdr
1567 * Desc: This function unpacks individual IPV6 Dest Option
1577 PUBLIC S16 cmUnpkCmIpv6DestOptsHdr
1579 CmIpv6DestOptsHdr *unpkParam,/* IPV6 Dest Option */
1580 Buffer *mBuf, /* message buffer */
1581 Mem *memInfo /* meminfo to allocate mem for dest opt */
1584 PUBLIC S16 cmUnpkCmIpv6DestOptsHdr (unpkParam, mBuf, memInfo)
1585 CmIpv6DestOptsHdr *unpkParam;/* IPV6 Dest Option */
1586 Buffer *mBuf; /* message buffer */
1587 Mem *memInfo; /* meminfo to allocate mem for dest opt */
1590 S32 retVal; /* temporary return value */
1591 U8 optLen; /* length of value field */
1593 TRC3(cmUnpkCmIpv6DestOptsHdr);
1595 /* unpack type, length */
1596 CMCHKUNPK(SUnpkU8, &unpkParam->type, mBuf);
1597 CMCHKUNPK(SUnpkU8, &unpkParam->length, mBuf);
1599 /* allocate static memory to hold the unpacked values */
1600 retVal = SGetSBuf(memInfo->region,
1602 (Data **)&unpkParam->value, (Size)unpkParam->length);
1608 /* unpack value fieldof this option */
1609 for(optLen = 0; optLen<unpkParam->length; optLen++)
1611 CMCHKUNPK(SUnpkU8, &unpkParam->value[optLen], mBuf);
1615 } /* end of cmUnpkCmIpv6DestOptsHdr */
1620 * Fun: cmUnpkCmIpv6DestOptsArr
1622 * Desc: This function unpacks the IPV6 Destination Option array
1632 PUBLIC S16 cmUnpkCmIpv6DestOptsArr
1634 CmIpv6DestOptsArr *unpkParam, /* all IPV6 Destination Options */
1635 Buffer *mBuf, /* message buffer */
1636 Mem *memInfo /* meminfo to allocate mem for dest opts */
1639 PUBLIC S16 cmUnpkCmIpv6DestOptsArr (unpkParam, mBuf, memInfo)
1640 CmIpv6DestOptsArr *unpkParam; /* all IPV6 Destination Options */
1641 Buffer *mBuf; /* message buffer */
1642 Mem *memInfo; /* meminfo to allocate mem for dest opts */
1648 TRC3(cmUnpkCmIpv6DestOptsArr);
1650 CMCHKUNPK(SUnpkU8, &unpkParam->numDestOpts, mBuf);
1651 if (unpkParam->numDestOpts)
1653 /* allocate mem to hold all dest options */
1654 retVal = SGetSBuf(memInfo->region,
1656 (Data **)&unpkParam->destOpts,
1657 (unpkParam->numDestOpts * sizeof(CmIpv6DestOptsHdr)));
1664 /* unpack all dest options */
1665 for(numOptions = 0; numOptions<unpkParam->numDestOpts; numOptions++)
1666 if ((retVal = cmUnpkCmIpv6DestOptsHdr(&unpkParam->destOpts[numOptions],
1667 mBuf, memInfo)) != ROK)
1672 } /* end of cmUnpkCmIpv6DestOptsArr */
1677 * Fun: cmPkCmIpv6HBHHdrArr
1679 * Desc: This function packs the all IPV6 HopByHop options
1689 PUBLIC S16 cmPkCmIpv6HBHHdrArr
1691 CmIpv6HBHHdrArr *pkParam, /* all IPV6 HopByHop options */
1692 Buffer *mBuf /* message buffer */
1695 PUBLIC S16 cmPkCmIpv6HBHHdrArr (pkParam, mBuf)
1696 CmIpv6HBHHdrArr *pkParam; /* IPV6 HopByHop options */
1697 Buffer *mBuf; /* message buffer */
1702 TRC3(cmPkCmIpv6HBHHdrArr);
1704 for(numOptions = 0; numOptions<pkParam->numHBHOpts; numOptions++)
1705 CMCHKPK(cmPkCmIpv6HBHHdr, &pkParam->hbhOpts[numOptions], mBuf);
1707 CMCHKPK(SPkU8, pkParam->numHBHOpts, mBuf);
1710 } /* end of cmPkCmIpv6HBHHdrArr */
1715 * Fun: cmPkCmIpv6HBHHdr
1717 * Desc: This function packs individual IPV6 HBH options
1727 PUBLIC S16 cmPkCmIpv6HBHHdr
1729 CmIpv6HBHHdr *pkParam, /* individual IPV6 HBH options */
1730 Buffer *mBuf /* message buffer */
1733 PUBLIC S16 cmPkCmIpv6HBHHdr (pkParam, mBuf)
1734 CmIpv6HBHHdr *pkParam; /* individual IPV6 HBH options */
1735 Buffer *mBuf; /* message buffer */
1740 TRC3(cmPkCmIpv6HBHHdr);
1742 /* pack value field */
1743 for(optLen = 0; optLen<pkParam->length; optLen++)
1745 CMCHKPK(SPkU8, pkParam->value[optLen], mBuf);
1748 /* pack type, length fields */
1749 CMCHKPK(SPkU8, pkParam->length, mBuf);
1750 CMCHKPK(SPkU8, pkParam->type, mBuf);
1753 } /* end of cmPkCmIpv6HBHHdr */
1758 * Fun: cmUnpkCmIpv6HBHHdr
1760 * Desc: This function unpacks individual IPV6 HBH Option
1770 PUBLIC S16 cmUnpkCmIpv6HBHHdr
1772 CmIpv6HBHHdr *unpkParam,/* individual IPV6 HBH Option */
1773 Buffer *mBuf, /* message buffer */
1774 Mem *memInfo /* meminfo to allocate mem for HBH opt */
1777 PUBLIC S16 cmUnpkCmIpv6HBHHdr (unpkParam, mBuf, memInfo)
1778 CmIpv6HBHHdr *unpkParam;/* individual IPV6 HBH Option */
1779 Buffer *mBuf; /* message buffer */
1780 Mem *memInfo; /* meminfo to allocate mem for HBH opt */
1783 S32 retVal; /* temporary return value */
1784 U8 optLen; /* length of value field */
1786 TRC3(cmUnpkCmIpv6HBHHdr)
1788 CMCHKUNPK(SUnpkU8, &unpkParam->type, mBuf);
1789 CMCHKUNPK(SUnpkU8, &unpkParam->length, mBuf);
1791 /* allocate static memory to hold the unpacked values */
1792 if (unpkParam->length)
1794 retVal = SGetSBuf(memInfo->region,
1796 (Data **)&unpkParam->value, (Size)unpkParam->length);
1802 for(optLen = 0; optLen<unpkParam->length; optLen++)
1803 CMCHKUNPK(SUnpkU8, &unpkParam->value[optLen], mBuf);
1807 } /* end of cmUnpkCmIpv6HBHHdr */
1812 * Fun: cmUnpkCmIpv6HBHHdrArr
1814 * Desc: This function unpacks all IPV6 HopByHop options
1824 PUBLIC S16 cmUnpkCmIpv6HBHHdrArr
1826 CmIpv6HBHHdrArr *unpkParam, /* all HBH options */
1827 Buffer *mBuf, /* message buffer */
1828 Mem *memInfo /* meminfo to allocate space for HBH opt */
1831 PUBLIC S16 cmUnpkCmIpv6HBHHdrArr (unpkParam, mBuf, memInfo)
1832 CmIpv6HBHHdrArr *unpkParam; /* all HBH options */
1833 Buffer *mBuf; /* message buffer */
1834 Mem *memInfo; /* meminfo to allocate space for HBH opt */
1840 TRC3(cmUnpkCmIpv6HBHHdrArr);
1842 CMCHKUNPK(SUnpkU8, &unpkParam->numHBHOpts, mBuf);
1843 if (unpkParam->numHBHOpts)
1845 /* allocate space for all HBH options */
1846 retVal = SGetSBuf(memInfo->region,
1848 (Data **)&unpkParam->hbhOpts,
1849 (unpkParam->numHBHOpts * sizeof(CmIpv6HBHHdr)));
1856 for(numOptions = 0; numOptions<unpkParam->numHBHOpts; numOptions++)
1857 cmUnpkCmIpv6HBHHdr(&unpkParam->hbhOpts[numOptions], mBuf, memInfo);
1860 } /* end of cmUnpkCmIpv6HBHHdrArr */
1861 #endif /* IPV6_OPTS_SUPPORTED */
1866 * Fun: cmUnpkCmIPHdrParm
1868 * Desc: This function unpacks the IP header parameters
1879 #ifdef IPV6_OPTS_SUPPORTED
1880 PUBLIC S16 cmUnpkCmIpHdrParm
1882 CmIpHdrParm *unpkParam,/* ip hdr parameters */
1883 Buffer *mBuf, /* message buffer */
1884 Mem *memInfo /* meminfo to allocate mem for ipHdrParam */
1887 PUBLIC S16 cmUnpkCmIpHdrParm
1889 CmIpHdrParm *unpkParam,/* ip hdr parameters */
1890 Buffer *mBuf /* message buffer */
1892 #endif /* IPV6_OPTS_SUPPORTED */
1895 #ifdef IPV6_OPTS_SUPPORTED
1896 PUBLIC S16 cmUnpkCmIpHdrParm (unpkParam, mBuf, memInfo)
1897 CmIpHdrParm *unpkParam;/* ip hdr parameters */
1898 Buffer *mBuf; /* message buffer */
1899 Mem *memInfo; /* meminfo to allocate mem for ipHdrParam */
1901 PUBLIC S16 cmUnpkCmIpHdrParm (unpkParam, mBuf)
1902 CmIpHdrParm *unpkParam;/* ip hdr parameters */
1903 Buffer *mBuf; /* message buffer */
1904 #endif /* IPV6_OPTS_SUPPORTED */
1907 TRC3(cmUnpkCmIpHdrParm)
1909 CMCHKUNPK(SUnpkU8, &unpkParam->type, mBuf);
1911 switch (unpkParam->type)
1913 case CM_HDRPARM_NOTPRSNT:
1914 case CM_HDRPARM_ICMP6:
1917 case CM_HDRPARM_IPV4:
1918 CMCHKUNPK(cmUnpkTknU8, &unpkParam->u.hdrParmIpv4.proto, mBuf);
1919 CMCHKUNPK(cmUnpkTknU8, &unpkParam->u.hdrParmIpv4.dfBit, mBuf);
1920 CMCHKUNPK(cmUnpkTknU8, &unpkParam->u.hdrParmIpv4.tos, mBuf);
1921 CMCHKUNPK(cmUnpkTknU8, &unpkParam->u.hdrParmIpv4.ttl, mBuf);
1922 #ifdef IPV4_OPTS_SUPPORTED
1923 CMCHKUNPK(cmUnpkTknStr64, &unpkParam->u.hdrParmIpv4.ipv4HdrOpt, mBuf);
1924 #endif /* IPV4_OPTS_SUPPORTED */
1927 case CM_HDRPARM_IPV6:
1928 #ifdef IPV6_SUPPORTED
1929 CMCHKUNPK(cmUnpkTknU8, &unpkParam->u.hdrParmIpv6.ttl, mBuf);
1931 CMCHKUNPK(cmUnpkCmNetAddr,
1932 &unpkParam->u.hdrParmIpv6.srcAddr6, mBuf);
1934 #ifdef IPV6_OPTS_SUPPORTED
1935 /* memInfo is passed forward to alloc mem to hold unpacked
1936 * IPV6 etx hdr data */
1937 cmUnpkCmIpv6ExtHdr(&unpkParam->u.hdrParmIpv6.ipv6ExtHdr,
1939 #endif /* IPV6_OPTS_SUPPORTED */
1940 #endif /* IPV6_SUPPORTED */
1948 } /* End of cmUnpkCmIpHdrParm */
1953 * Fun: cmPkCmIcmpFilter
1955 * Desc: This function packs the ICMP filter parameters
1965 PUBLIC S16 cmPkCmIcmpFilter
1967 CmIcmpFilter *pkParam,
1968 Buffer *mBuf /* message buffer */
1971 PUBLIC S16 cmPkCmIcmpFilter (pkParam, mBuf)
1972 CmIcmpFilter *pkParam;
1973 Buffer *mBuf; /* message buffer */
1976 /* Variable declaration */
1979 TRC3(cmPkCmIcmpFilter)
1981 switch (pkParam->type)
1983 case CM_ICMP_NO_FILTER:
1986 case CM_ICMPVER4_FILTER:
1987 for(idx = (pkParam->u.icmpv4Filter.num-1); idx >= 0; idx--)
1989 CMCHKPK(SPkU32, pkParam->u.icmpv4Filter.icmpError[idx].errCodeMask,
1991 CMCHKPK(SPkU8, pkParam->u.icmpv4Filter.icmpError[idx].errType,
1994 CMCHKPK(SPkU8, pkParam->u.icmpv4Filter.num, mBuf);
1995 CMCHKPK(SPkU8, pkParam->u.icmpv4Filter.protocol, mBuf);
1996 CMCHKPK(SPkU8, pkParam->u.icmpv4Filter.allMsg, mBuf);
1997 CMCHKPK(SPkU8, pkParam->u.icmpv4Filter.icmpMsgFlag, mBuf);
2000 case CM_ICMPVER6_FILTER:
2001 /* The structure is yet to be decided */
2002 /* CMCHKPK(cmPkCmIpv6HdrParm, &pkParam->u.ipv6HdrParm, mBuf); */
2003 #ifdef IPV6_SUPPORTED
2004 for(idx = (pkParam->u.icmpv6Filter.num - 1); idx >= 0; idx--)
2006 CMCHKPK(SPkU32, pkParam->u.icmpv6Filter.icmpError[idx].errCodeMask,
2008 CMCHKPK(SPkU8, pkParam->u.icmpv6Filter.icmpError[idx].errType,
2011 CMCHKPK(SPkU8, pkParam->u.icmpv6Filter.num, mBuf);
2012 CMCHKPK(SPkU8, pkParam->u.icmpv4Filter.allMsg, mBuf);
2013 CMCHKPK(SPkU8, pkParam->u.icmpv4Filter.icmpMsgFlag, mBuf);
2014 #endif /* IPV6_SUPPORTED */
2020 CMCHKPK(SPkU8, pkParam->type, mBuf);
2028 * Fun: cmUnpkCmIcmpFilter
2030 * Desc: This function unpacks the
2040 PUBLIC S16 cmUnpkCmIcmpFilter
2042 CmIcmpFilter *unpkParam,
2043 Buffer *mBuf /* message buffer */
2046 PUBLIC S16 cmUnpkCmIcmpFilter (unpkParam, mBuf)
2047 CmIcmpFilter *unpkParam;
2048 Buffer *mBuf; /* message buffer */
2051 /* Variable declaration */
2054 TRC3(cmUnpkCmIcmpFilter)
2056 CMCHKUNPK(SUnpkU8, &unpkParam->type, mBuf);
2058 switch (unpkParam->type)
2060 case CM_ICMP_NO_FILTER:
2063 case CM_ICMPVER4_FILTER:
2064 CMCHKUNPK(SUnpkU8, &unpkParam->u.icmpv4Filter.icmpMsgFlag, mBuf);
2065 CMCHKUNPK(SUnpkU8, &unpkParam->u.icmpv4Filter.allMsg, mBuf);
2066 CMCHKUNPK(SUnpkU8, &unpkParam->u.icmpv4Filter.protocol, mBuf);
2067 CMCHKUNPK(SUnpkU8, &unpkParam->u.icmpv4Filter.num, mBuf);
2069 for(idx = 0; idx < (unpkParam->u.icmpv4Filter.num); idx++)
2072 &unpkParam->u.icmpv4Filter.icmpError[idx].errType, mBuf);
2074 &unpkParam->u.icmpv4Filter.icmpError[idx].errCodeMask,
2079 case CM_ICMPVER6_FILTER:
2080 #ifdef IPV6_SUPPORTED
2081 CMCHKUNPK(SUnpkU8, &unpkParam->u.icmpv6Filter.icmpMsgFlag, mBuf);
2082 CMCHKUNPK(SUnpkU8, &unpkParam->u.icmpv6Filter.allMsg, mBuf);
2083 CMCHKUNPK(SUnpkU8, &unpkParam->u.icmpv6Filter.num, mBuf);
2085 for(idx = 0; idx < (unpkParam->u.icmpv6Filter.num); idx++)
2088 &unpkParam->u.icmpv6Filter.icmpError[idx].errType, mBuf);
2090 &unpkParam->u.icmpv6Filter.icmpError[idx].errCodeMask,
2093 #endif /* IPV6_SUPPORTED */
2102 } /* End of cmUnpkCmIcmpFilter */
2104 #endif /* CM_INET2 */
2107 #endif /* if(LCHCT || LCHIT || LCLHC || LCHRT || LCLHR) */
2110 /********************************************************************30**
2112 *********************************************************************31*/