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 S16 cmPkCmIpv4TptAddr
120 CmIpv4TptAddr *pkParam, /* IPv4 Address structure */
121 Buffer *mBuf /* message buffer */
124 S16 cmPkCmIpv4TptAddr (pkParam, mBuf)
125 CmIpv4TptAddr *pkParam; /* IPv4 Address structure */
126 Buffer *mBuf; /* message buffer */
130 CMCHKPK(cmPkCmIpv4NetAddr, pkParam->address, mBuf);
131 CMCHKPK(oduUnpackUInt16, pkParam->port, mBuf);
134 } /* cmPkCmIpv4TptAddr */
138 * Fun: cmPkCmIpv6NetAddr
140 * Desc: This function packs the 16 bytes of IPv6 address
150 static S16 cmPkCmIpv6NetAddr
152 CmIpv6NetAddr *pkParam,
153 Buffer *mBuf /* message buffer */
156 static S16 cmPkCmIpv6NetAddr (pkParam, mBuf)
157 CmIpv6NetAddr *pkParam;
158 Buffer *mBuf; /* message buffer */
162 uint8_t *ptr = (uint8_t*)pkParam;
165 for(num = 0; num < CM_IPV6ADDR_SIZE; num++)
167 CMCHKPK(oduUnpackUInt8, *(ptr+num), mBuf);
171 } /* end of cmPkCmIpv6NetAddr */
176 * Fun: cmPkCmIpv6TptAddr
178 * Desc: This function packs the IPv6 transport address
188 static S16 cmPkCmIpv6TptAddr
190 CmIpv6TptAddr *pkParam, /* IPv6 transport address */
191 Buffer *mBuf /* message buffer */
194 static S16 cmPkCmIpv6TptAddr (pkParam, mBuf)
195 CmIpv6TptAddr *pkParam; /* IPv6 transport address */
196 Buffer *mBuf; /* message buffer */
200 CMCHKPK(cmPkCmIpv6NetAddr, &pkParam->ipv6NetAddr, mBuf);
201 CMCHKPK(oduUnpackUInt16, pkParam->port, mBuf);
204 } /* cmPkCmIpv6TptAddr */
209 * Fun: cmPkCmNetAddrTbl
211 * Desc: This function packs the
223 CmNetAddrTbl *pkParam, /* Network Address Table */
224 Buffer *mBuf /* message buffer */
227 S16 cmPkCmNetAddrTbl (pkParam, mBuf)
228 CmNetAddrTbl *pkParam; /* Network Address Table */
229 Buffer *mBuf; /* message buffer */
232 uint16_t idx; /* Loop Index */
233 CmNetAddr *netAddr; /* Network Address */
236 if (pkParam->count > CM_MAX_NET_ADDR)
239 /* Pack All the addresses */
240 for (idx = pkParam->count; idx; idx--)
242 netAddr = &(pkParam->netAddr[idx - 1]);
244 if ((cmPkCmNetAddr(netAddr, mBuf)) != ROK)
248 /* Pack the total number of addresses present in the table */
249 CMCHKPK(oduUnpackUInt16, pkParam->count, mBuf);
253 } /* end of cmPkCmNetAddrTbl() */
259 * Desc: This function packs the
272 Buffer *mBuf /* message buffer */
275 S16 cmPkCmNetAddr (pkParam, mBuf)
277 Buffer *mBuf; /* message buffer */
281 switch (pkParam->type)
283 case CM_NETADDR_NOTPRSNT:
286 case CM_NETADDR_IPV4:
287 CMCHKPK(cmPkCmIpv4NetAddr, pkParam->u.ipv4NetAddr, mBuf);
290 case CM_NETADDR_IPV6:
291 CMCHKPK(cmPkCmIpv6NetAddr, &pkParam->u.ipv6NetAddr, mBuf);
297 CMCHKPK(oduUnpackUInt8, pkParam->type, mBuf);
300 } /* cmPkCmNetAddr */
307 * Desc: This function packs the
320 Buffer *mBuf /* message buffer */
323 S16 cmPkCmTptAddr (pkParam, mBuf)
325 Buffer *mBuf; /* message buffer */
329 switch (pkParam->type)
331 case CM_TPTADDR_NOTPRSNT:
334 case CM_TPTADDR_IPV4:
335 CMCHKPK(cmPkCmIpv4TptAddr, &pkParam->u.ipv4TptAddr, mBuf);
338 case CM_TPTADDR_IPV6:
339 CMCHKPK(cmPkCmIpv6TptAddr, &pkParam->u.ipv6TptAddr, mBuf);
345 CMCHKPK(oduUnpackUInt8, pkParam->type, mBuf);
348 } /* cmPkCmTptAddr */
350 /* added new packing functions */
354 * Fun: cmPkCmTptLocalInf
356 * Desc: This function packs the local interface info on which IPV4/IPV6
357 * packet was received on.
367 S16 cmPkCmTptLocalInf
369 CmTptLocalInf *pkParam, /* local interface info */
370 Buffer *mBuf /* message buffer */
373 S16 cmPkCmTptLocalInf (pkParam, mBuf)
374 CmTptLocalInf *pkParam; /* local interface info */
375 Buffer *mBuf; /* message buffer */
379 if (pkParam->intfPrsnt == TRUE)
381 /* pack the actual interface address */
382 CMCHKPK(cmPkCmNetAddr, &pkParam->localIfAddr, mBuf);
383 /* pack the interface index value */
384 CMCHKPK(oduUnpackUInt32, pkParam->localIf, mBuf);
386 /* pack the boll which indicates if valid local intf is present or not */
387 CMCHKPK(oduUnpackUInt8, pkParam->intfPrsnt, mBuf);
389 } /* cmPkCmTptLocalInf */
390 #endif /* LOCAL_INTF */
392 /* Moving IPv6 multicast information packing functions from cm_inet.c */
393 #ifdef IPV6_SUPPORTED
396 * Fun: cmPkCmNetMCastInf6
398 * Desc: This function packs the IPv6 multicast information
408 S16 cmPkCmNetMCastInf6
410 CmNetMCastInf6 *pkParam, /* IPv6 multicast information */
411 Buffer *mBuf /* message buffer */
414 S16 cmPkCmNetMCastInf6(pkParam, mBuf)
415 CmNetMCastInf6 *pkParam; /* IPv6 multicast information */
416 Buffer *mBuf; /* message buffer */
420 CMCHKPK(cmPkCmIpv6NetAddr, &pkParam->mCastAddr, mBuf);
421 CMCHKPK(oduUnpackUInt32, pkParam->localInf, mBuf);
424 } /* cmPkCmNetMCastInf6 */
425 #endif /* IPV6_SUPPORTED */
430 * Fun: cmPkCmSockOpts
432 * Desc: This function packs the
442 static S16 cmPkCmSockOpts
445 Buffer *mBuf /* message buffer */
448 static S16 cmPkCmSockOpts (pkParam, mBuf)
450 Buffer *mBuf; /* message buffer */
454 switch (pkParam->option)
456 case CM_SOCKOPT_OPT_ADD_MCAST_MBR:
457 case CM_SOCKOPT_OPT_DRP_MCAST_MBR:
459 CMCHKPK(cmPkCmNetAddr, &pkParam->optVal.mCastInfo.mCastAddr, mBuf);
460 CMCHKPK(cmPkCmNetAddr, &pkParam->optVal.mCastInfo.localAddr, mBuf);
462 CMCHKPK(cmPkCmNetAddr, &pkParam->optVal.mCastAddr, mBuf);
463 #endif /* CM_INET2 */
466 case CM_SOCKOPT_OPT_MCAST_IF:
467 CMCHKPK(cmPkCmNetAddr, &pkParam->optVal.lclAddr, mBuf);
470 #ifdef IPV6_SUPPORTED
471 case CM_SOCKOPT_OPT_ADD_MCAST6_MBR:
472 case CM_SOCKOPT_OPT_DRP_MCAST6_MBR:
473 CMCHKPK(cmPkCmNetMCastInf6, &pkParam->optVal.mCastInfo6, mBuf);
476 case CM_SOCKOPT_OPT_MCAST6_IF:
477 CMCHKPK(oduUnpackUInt32, pkParam->optVal.infId, mBuf);
480 #endif /* IPV6_SUPPORTED */
483 CMCHKPK(oduUnpackUInt32, pkParam->optVal.value, mBuf);
486 CMCHKPK(oduUnpackUInt32, pkParam->option, mBuf);
487 CMCHKPK(oduUnpackUInt32, pkParam->level, mBuf);
490 } /* cmPkCmSockOpts */
495 * Fun: cmPkCmSockParam
497 * Desc: This function packs the
507 static S16 cmPkCmSockParam
509 CmSockParam *pkParam,
510 Buffer *mBuf /* message buffer */
513 static S16 cmPkCmSockParam (pkParam, mBuf)
514 CmSockParam *pkParam;
515 Buffer *mBuf; /* message buffer */
521 if( pkParam->numOpts > CM_MAX_SOCK_OPTS)
525 for(num = 0; num < pkParam->numOpts; num++)
527 CMCHKPK(cmPkCmSockOpts, &pkParam->sockOpts[num], mBuf);
529 CMCHKPK(oduUnpackUInt8, pkParam->numOpts, mBuf);
530 CMCHKPK(oduUnpackUInt8, pkParam->listenQSize, mBuf);
533 } /* cmPkCmSockParam */
539 * Fun: cmPkTlsTptParam
541 * Desc: This function packs the
551 static S16 cmPkTlsTptParam
553 TlsTptParam *pkParam, /**/
554 Buffer *mBuf /* message buffer */
557 static S16 cmPkTlsTptParam(pkParam, mBuf)
558 TlsTptParam *pkParam; /**/
559 Buffer *mBuf; /* message buffer */
565 if( pkParam->numOpts > CM_MAX_SOCK_OPTS)
569 for(num = 0; num < pkParam->numOpts; num++)
571 CMCHKPK(cmPkCmSockOpts, &pkParam->sockOpts[num], mBuf);
573 CMCHKPK(oduUnpackUInt8, pkParam->numOpts, mBuf);
574 CMCHKPK(oduUnpackUInt8, pkParam->listenQSize, mBuf);
575 CMCHKPK(SPkS16, pkParam->ctxId, mBuf);
578 } /* cmPkTlsTptParam */
585 * Fun: cmPkCmTptParam
587 * Desc: This function packs the
600 Buffer *mBuf /* message buffer */
603 S16 cmPkCmTptParam (pkParam, mBuf)
605 Buffer *mBuf; /* message buffer */
609 switch (pkParam->type)
611 case CM_TPTPARAM_NOTPRSNT:
614 case CM_TPTPARAM_SOCK:
615 CMCHKPK(cmPkCmSockParam, &pkParam->u.sockParam, mBuf);
619 case CM_TPTPARAM_AAL:
620 CMCHKPK(cmPkAalConParam, &pkParam->u.aalParam, mBuf);
625 case CM_TPTPARAM_TLS:
626 CMCHKPK(cmPkTlsTptParam, &pkParam->u.tlsParam, mBuf);
634 CMCHKPK(oduUnpackUInt8, pkParam->type, mBuf);
637 } /* cmPkCmTptParam */
641 * UNPACKING FUNCTIONS
644 /* Moving IPv4 address un-packing functions from cm_inet.c file */
648 * Fun: cmUnpkCmIpv4TptAddr
650 * Desc: This function unpacks the IPv4 address
660 S16 cmUnpkCmIpv4TptAddr
662 CmIpv4TptAddr *unpkParam, /* IPv4 Address */
663 Buffer *mBuf /* message buffer */
666 S16 cmUnpkCmIpv4TptAddr (unpkParam, mBuf)
667 CmIpv4TptAddr *unpkParam; /* IPv4 Address */
668 Buffer *mBuf; /* message buffer */
672 CMCHKUNPK(oduPackUInt16, &unpkParam->port, mBuf);
673 CMCHKUNPK(cmUnpkCmIpv4NetAddr, &unpkParam->address, mBuf);
676 } /* cmUnpkCmIpv4TptAddr */
681 * Fun: cmUnpkCmIpv6NetAddr
683 * Desc: This function unpacks the 16 bytes of IPv6 address
693 static S16 cmUnpkCmIpv6NetAddr
695 CmIpv6NetAddr *unpkParam, /* IPv6 address */
696 Buffer *mBuf /* message buffer */
699 static S16 cmUnpkCmIpv6NetAddr (unpkParam, mBuf)
700 CmIpv6NetAddr *unpkParam; /* IPv6 address */
701 Buffer *mBuf; /* message buffer */
705 uint8_t *ptr = (uint8_t*)unpkParam;
708 ptr += (CM_INET_IPV6ADDR_SIZE - 1);
710 for(num = 0; num < CM_IPV6ADDR_SIZE; num++)
712 CMCHKUNPK(oduPackUInt8, (ptr-num), mBuf);
716 } /* end of cmUnpkCmIpv6NetAddr */
721 * Fun: cmUnpkCmIpv6TptAddr
723 * Desc: This function unpacks the IPv6 transport address
733 static S16 cmUnpkCmIpv6TptAddr
735 CmIpv6TptAddr *unpkParam, /* IPv6 transport address */
736 Buffer *mBuf /* message buffer */
739 static S16 cmUnpkCmIpv6TptAddr (unpkParam, mBuf)
740 CmIpv6TptAddr *unpkParam; /* IPv6 transport address */
741 Buffer *mBuf; /* message buffer */
745 CMCHKUNPK(oduPackUInt16, &unpkParam->port, mBuf);
746 CMCHKUNPK(cmUnpkCmIpv6NetAddr, &unpkParam->ipv6NetAddr, mBuf);
749 } /* cmUnpkCmIpv6TptAddr */
754 * Fun: cmUnpkCmNetAddrTbl
756 * Desc: This function unpacks the
766 S16 cmUnpkCmNetAddrTbl
768 CmNetAddrTbl *unpkParam, /* Network Address Table */
769 Buffer *mBuf /* message buffer */
772 S16 cmUnpkCmNetAddrTbl (unpkParam, mBuf )
773 CmNetAddrTbl *unpkParam; /* Network Address Table */
774 Buffer *mBuf; /* message buffer */
777 uint16_t idx; /* Loop Index */
778 CmNetAddr *netAddr; /* Network Address */
781 /* Unpack the count */
782 CMCHKUNPK(oduPackUInt16, &(unpkParam->count), mBuf);
784 /* Unpack the addresses */
785 for (idx = 0; idx < unpkParam->count; idx++)
787 netAddr = &(unpkParam->netAddr[idx]);
789 if ((cmUnpkCmNetAddr(netAddr, mBuf)) != ROK)
795 } /* end of cmUnpkCmNetAddrTbl() */
800 * Fun: cmUnpkCmNetAddr
802 * Desc: This function unpacks the network address
814 CmNetAddr *unpkParam,
815 Buffer *mBuf /* message buffer */
818 S16 cmUnpkCmNetAddr (unpkParam, mBuf )
819 CmNetAddr *unpkParam;
820 Buffer *mBuf; /* message buffer */
824 CMCHKUNPK(oduPackUInt8, &unpkParam->type, mBuf);
826 switch (unpkParam->type)
828 case CM_NETADDR_NOTPRSNT:
831 case CM_NETADDR_IPV4:
832 CMCHKUNPK(cmUnpkCmIpv4NetAddr, &unpkParam->u.ipv4NetAddr, mBuf);
835 case CM_NETADDR_IPV6:
836 CMCHKUNPK(cmUnpkCmIpv6NetAddr, &unpkParam->u.ipv6NetAddr, mBuf);
844 } /* cmUnpkCmNetAddr */
849 * Fun: cmUnpkCmTptAddr
851 * Desc: This function unpacks the
863 CmTptAddr *unpkParam,
864 Buffer *mBuf /* message buffer */
867 S16 cmUnpkCmTptAddr (unpkParam, mBuf)
868 CmTptAddr *unpkParam;
869 Buffer *mBuf; /* message buffer */
873 CMCHKUNPK(oduPackUInt8, &unpkParam->type, mBuf);
875 switch (unpkParam->type)
877 case CM_TPTADDR_NOTPRSNT:
880 case CM_TPTADDR_IPV4:
881 CMCHKUNPK(cmUnpkCmIpv4TptAddr, &unpkParam->u.ipv4TptAddr, mBuf);
884 case CM_TPTADDR_IPV6:
885 CMCHKUNPK(cmUnpkCmIpv6TptAddr, &unpkParam->u.ipv6TptAddr, mBuf);
893 } /* cmUnpkCmTptAddr */
895 /* Moving IPv6 multicast information unpacking functions from cm_inet.c */
896 #ifdef IPV6_SUPPORTED
900 * Fun: cmUnpkCmNetMCastInf6
902 * Desc: This function unpacks the IPv6 multicast information
912 S16 cmUnpkCmNetMCastInf6
914 CmNetMCastInf6 *unpkParam, /* IPv6 multicast information */
915 Buffer *mBuf /* message buffer */
918 S16 cmUnpkCmNetMCastInf6(unpkParam, mBuf)
919 CmNetMCastInf6 *unpkParam; /* IPv6 multicast information */
920 Buffer *mBuf; /* message buffer */
924 CMCHKUNPK(oduPackUInt32, &unpkParam->localInf, mBuf);
925 CMCHKUNPK(cmUnpkCmIpv6NetAddr, &unpkParam->mCastAddr, mBuf);
928 } /* cmUnpkCmNetMCastInf6 */
929 #endif /* IPV6_SUPPORTED */
934 * Fun: cmUnpkCmSockOpts
936 * Desc: This function unpacks the socket options
946 static S16 cmUnpkCmSockOpts
948 CmSockOpts *unpkParam, /* socket options */
949 Buffer *mBuf /* message buffer */
952 static S16 cmUnpkCmSockOpts (unpkParam, mBuf)
953 CmSockOpts *unpkParam; /* socket options */
954 Buffer *mBuf; /* message buffer */
958 CMCHKUNPK(oduPackUInt32, &unpkParam->level, mBuf);
959 CMCHKUNPK(oduPackUInt32, &unpkParam->option, mBuf);
961 switch (unpkParam->option)
963 case CM_SOCKOPT_OPT_ADD_MCAST_MBR:
964 case CM_SOCKOPT_OPT_DRP_MCAST_MBR:
966 CMCHKUNPK(cmUnpkCmNetAddr, &unpkParam->optVal.mCastInfo.localAddr,
968 CMCHKUNPK(cmUnpkCmNetAddr, &unpkParam->optVal.mCastInfo.mCastAddr,
971 CMCHKUNPK(cmUnpkCmNetAddr, &unpkParam->optVal.mCastAddr, mBuf);
972 #endif /* CM_INET2 */
975 case CM_SOCKOPT_OPT_MCAST_IF:
976 CMCHKUNPK(cmUnpkCmNetAddr, &unpkParam->optVal.lclAddr, mBuf);
979 #ifdef IPV6_SUPPORTED
980 case CM_SOCKOPT_OPT_ADD_MCAST6_MBR:
981 case CM_SOCKOPT_OPT_DRP_MCAST6_MBR:
982 CMCHKUNPK(cmUnpkCmNetMCastInf6, &unpkParam->optVal.mCastInfo6, mBuf);
985 case CM_SOCKOPT_OPT_MCAST6_IF:
986 CMCHKUNPK(oduPackUInt32, &unpkParam->optVal.infId, mBuf);
988 #endif /* IPV6_SUPPORTED */
991 CMCHKUNPK(oduPackUInt32, &unpkParam->optVal.value, mBuf);
996 } /* cmUnpkCmSockOpts */
1001 * Fun: cmUnpkCmSockParam
1003 * Desc: This function unpacks the socket parameters
1013 static S16 cmUnpkCmSockParam
1015 CmSockParam *unpkParam, /* socket parameters */
1016 Buffer *mBuf /* message buffer */
1019 static S16 cmUnpkCmSockParam (unpkParam, mBuf)
1020 CmSockParam *unpkParam; /* socket parameters */
1021 Buffer *mBuf; /* message buffer */
1027 CMCHKUNPK(oduPackUInt8, &unpkParam->listenQSize, mBuf);
1028 CMCHKUNPK(oduPackUInt8, &unpkParam->numOpts, mBuf);
1030 if( unpkParam->numOpts > CM_MAX_SOCK_OPTS)
1035 for(num = 0; num < unpkParam->numOpts; num++)
1037 CMCHKUNPK(cmUnpkCmSockOpts, &unpkParam->sockOpts[num], mBuf);
1041 } /* cmUnpkCmSockParam */
1047 * Fun: cmUnpkTlsTptParam
1049 * Desc: This function unpacks the socket parameters
1059 static S16 cmUnpkTlsTptParam
1061 TlsTptParam *unpkParam, /* TLS parameters */
1062 Buffer *mBuf /* message buffer */
1065 static S16 cmUnpkTlsTptParam (unpkParam, mBuf)
1066 TlsTptParam *unpkParam; /* TLS parameters */
1067 Buffer *mBuf; /* message buffer */
1073 CMCHKUNPK(SUnpkS16, &unpkParam->ctxId, mBuf);
1074 CMCHKUNPK(oduPackUInt8, &unpkParam->listenQSize, mBuf);
1075 CMCHKUNPK(oduPackUInt8, &unpkParam->numOpts, mBuf);
1077 if( unpkParam->numOpts > CM_MAX_SOCK_OPTS)
1082 for(num = 0; num < unpkParam->numOpts; num++)
1084 CMCHKUNPK(cmUnpkCmSockOpts, &unpkParam->sockOpts[num], mBuf);
1088 } /* cmUnpkTlsTptParam */
1095 * Fun: cmUnpkCmTptParam
1097 * Desc: This function unpacks the transport parameters
1107 S16 cmUnpkCmTptParam
1109 CmTptParam *unpkParam, /* transport parameters */
1110 Buffer *mBuf /* message buffer */
1113 S16 cmUnpkCmTptParam (unpkParam, mBuf)
1114 CmTptParam *unpkParam; /* transport parameters */
1115 Buffer *mBuf; /* message buffer */
1119 CMCHKUNPK(oduPackUInt8, &unpkParam->type, mBuf);
1121 switch (unpkParam->type)
1123 case CM_TPTPARAM_NOTPRSNT:
1126 case CM_TPTPARAM_SOCK:
1127 CMCHKUNPK(cmUnpkCmSockParam, &unpkParam->u.sockParam, mBuf);
1131 case CM_TPTPARAM_AAL:
1132 CMCHKUNPK(cmUnpkAalConParam, &unpkParam->u.aalParam, mBuf);
1137 case CM_TPTPARAM_TLS:
1138 CMCHKUNPK(cmUnpkTlsTptParam, &unpkParam->u.tlsParam, mBuf);
1147 } /* cmUnpkCmTptParam */
1154 * Fun: cmPkCmIpHdrParm
1156 * Desc: This function packs the the IP hedear parameters for both
1169 CmIpHdrParm *pkParam, /* IP hdr parameters */
1170 Buffer *mBuf /* message buffer */
1173 S16 cmPkCmIpHdrParm (pkParam, mBuf)
1174 CmIpHdrParm *pkParam; /* IP hdr parameters */
1175 Buffer *mBuf; /* message buffer */
1179 switch (pkParam->type)
1181 case CM_HDRPARM_NOTPRSNT:
1182 case CM_HDRPARM_ICMP6:
1185 case CM_HDRPARM_IPV4:
1187 /* call to pack ipv4 options */
1188 #ifdef IPV4_OPTS_SUPPORTED
1189 /* ipv4 IP options */
1190 CMCHKPK(cmPkTknStr64, &pkParam->u.hdrParmIpv4.ipv4HdrOpt, mBuf);
1191 #endif /* IPV4_OPTS_SUPPORTED */
1193 CMCHKPK(cmPkTknUInt8, &pkParam->u.hdrParmIpv4.ttl, mBuf);
1194 CMCHKPK(cmPkTknUInt8, &pkParam->u.hdrParmIpv4.tos, mBuf);
1195 CMCHKPK(cmPkTknUInt8, &pkParam->u.hdrParmIpv4.dfBit, mBuf);
1196 CMCHKPK(cmPkTknUInt8, &pkParam->u.hdrParmIpv4.proto, mBuf);
1199 case CM_HDRPARM_IPV6:
1200 #ifdef IPV6_SUPPORTED
1201 /* call to pack ipv6 extn hdrs */
1202 #ifdef IPV6_OPTS_SUPPORTED
1203 /* pack IPV6 extension headers */
1204 CMCHKPK(cmPkCmIpv6ExtHdr, &pkParam->u.hdrParmIpv6.ipv6ExtHdr, mBuf);
1205 #endif /* IPV6_OPTS_SUPPORTED */
1206 CMCHKPK(cmPkCmNetAddr, &pkParam->u.hdrParmIpv6.srcAddr6, mBuf);
1207 CMCHKPK(cmPkTknUInt8, &pkParam->u.hdrParmIpv6.ttl, mBuf);
1208 #endif /* IPV6_SUPPORTED */
1214 CMCHKPK(oduUnpackUInt8, pkParam->type, mBuf);
1217 } /* End of cmPkCmIpHdrParm */
1220 /* added new unpack function for local interface */
1224 * Fun: cmUnpkCmTptLocalInf
1226 * Desc: This function unpacks the local interface info on which
1227 * IPV4/IPV6 packet was received on.
1237 S16 cmUnpkCmTptLocalInf
1239 CmTptLocalInf *unpkParam, /* local interface info */
1240 Buffer *mBuf /* message buffer */
1243 S16 cmUnpkCmTptLocalInf (unpkParam, mBuf)
1244 CmTptLocalInf *unpkParam; /* local interface info */
1245 Buffer *mBuf; /* message buffer */
1249 /* first unpack the bool intfPrsnt value which is always packed */
1250 CMCHKUNPK(oduUnpackBool, &unpkParam->intfPrsnt, mBuf);
1252 /* if the above unpacked bool is TRUE then we have to unpack further
1253 * to get the local intf index and intf address */
1254 if (unpkParam->intfPrsnt == TRUE)
1256 CMCHKUNPK(oduPackUInt32, &unpkParam->localIf, mBuf);
1257 CMCHKUNPK(cmUnpkCmNetAddr, &unpkParam->localIfAddr, mBuf);
1260 } /* cmUnpkCmTptLocalInf */
1261 #endif /* LOCAL_INTF */
1264 /* added new functions */
1265 #ifdef IPV6_OPTS_SUPPORTED
1267 * Fun: cmPkCmIpv6ExtHdr
1269 * Desc: This function packs the IPV6 extension headers
1279 S16 cmPkCmIpv6ExtHdr
1281 CmIpv6ExtHdr *pkParam, /* IPV6 extension hdrs */
1282 Buffer *mBuf /* message buffer */
1285 S16 cmPkCmIpv6ExtHdr (pkParam, mBuf)
1286 CmIpv6ExtHdr *pkParam; /*IPV6 extension hdrs */
1287 Buffer *mBuf; /* message buffer */
1291 /* pack first Route hdr */
1292 if (pkParam->rtOptsPrsnt)
1293 CMCHKPK(cmPkCmIpv6RtHdr, &pkParam->rtOpts, mBuf);
1294 CMCHKPK(oduPackBool, pkParam->rtOptsPrsnt, mBuf);
1296 /* pack Dest Opt hdr */
1297 if (pkParam->destOptsPrsnt)
1298 CMCHKPK(cmPkCmIpv6DestOptsArr, &pkParam->destOptsArr, mBuf);
1299 CMCHKPK(oduPackBool, pkParam->destOptsPrsnt, mBuf);
1302 if (pkParam->hbhHdrPrsnt)
1303 CMCHKPK(cmPkCmIpv6HBHHdrArr, &pkParam->hbhOptsArr, mBuf);
1304 CMCHKPK(oduPackBool, pkParam->hbhHdrPrsnt, mBuf);
1307 } /* end of cmPkCmIpv6ExtHdr */
1312 * Fun: cmPkCmIpv6RtHdr
1314 * Desc: This function packs the IPV6 route header
1326 CmIpv6RtHdr *pkParam, /* IPV6 Route hdr */
1327 Buffer *mBuf /* message buffer */
1330 S16 cmPkCmIpv6RtHdr (pkParam, mBuf)
1331 CmIpv6RtHdr *pkParam; /* IPV6 Route hdr */
1332 Buffer *mBuf; /* message buffer */
1338 /* pack all IPV6 addrs in the route hdr */
1339 for(idx = 0; idx < pkParam->numAddrs; idx++)
1341 CMCHKPK(cmPkCmIpv6NetAddr, &pkParam->ipv6Addrs[idx], mBuf);
1343 /* pack reserve byte & strict/loose bit map */
1344 CMCHKPK(oduUnpackUInt32, pkParam->slMap, mBuf);
1345 CMCHKPK(oduUnpackUInt8, pkParam->numAddrs, mBuf);
1348 } /* end of cmPkCmIpv6RtHdr */
1353 * Fun: cmUnpkCmIpv6RtHdr
1355 * Desc: This function unpacks the IPV6 route header
1358 * ROUTRES - out of resources
1366 S16 cmUnpkCmIpv6RtHdr
1368 CmIpv6RtHdr *unpkParam, /* IPV6 Route hdr */
1369 Buffer *mBuf, /* message buffer */
1370 Mem *memInfo /* meminfo to allocate for Route hdr */
1373 S16 cmUnpkCmIpv6RtHdr (unpkParam, mBuf, memInfo)
1374 CmIpv6RtHdr *unpkParam; /* IPV6 Route hdr */
1375 Buffer *mBuf; /* message buffer */
1376 Mem *memInfo; /* meminfo to allocate for Route hdr */
1379 uint8_t idx; /* array index */
1380 S32 retVal; /* temporary return value */
1383 CMCHKUNPK(oduPackUInt8, &unpkParam->numAddrs, mBuf);
1385 /* unpack reserve byte & strict/loose bit map */
1386 CMCHKUNPK(oduPackUInt32, &unpkParam->slMap, mBuf);
1388 retVal = SGetSBuf(memInfo->region,
1390 (Data **)&unpkParam->ipv6Addrs,
1391 (unpkParam->numAddrs * 16));
1398 /* unpack all IPV6 addrs in the route hdr */
1399 for(idx = 0; idx < unpkParam->numAddrs; idx++)
1401 CMCHKUNPK(cmUnpkCmIpv6NetAddr, &unpkParam->ipv6Addrs[idx], mBuf);
1405 } /* end of cmUnpkCmIpv6RtHdr */
1410 * Fun: cmUnpkCmIpv6ExtHdr
1412 * Desc: This function unpacks the IPv6 extension header
1422 S16 cmUnpkCmIpv6ExtHdr
1424 CmIpv6ExtHdr *unpkParam, /* IPV6 extension hdrs */
1425 Buffer *mBuf, /* message buffer */
1426 Mem *memInfo /* meminfo to allocate for IPV6 ext hdr */
1429 S16 cmUnpkCmIpv6ExtHdr (unpkParam, mBuf, memInfo)
1430 CmIpv6ExtHdr *unpkParam; /* IPV6 extension hdrs */
1431 Buffer *mBuf; /* message buffer */
1432 Mem *memInfo; /* meminfo to allocate for IPV6 ext hdr */
1436 /* unpack HBH hdr first */
1437 CMCHKUNPK(oduUnpackBool, &unpkParam->hbhHdrPrsnt, mBuf);
1438 if (unpkParam->hbhHdrPrsnt)
1439 cmUnpkCmIpv6HBHHdrArr(&unpkParam->hbhOptsArr, mBuf, memInfo);
1441 /* unpack DEST opt hdr */
1442 CMCHKUNPK(oduUnpackBool, &unpkParam->destOptsPrsnt, mBuf);
1443 if (unpkParam->destOptsPrsnt)
1444 cmUnpkCmIpv6DestOptsArr(&unpkParam->destOptsArr, mBuf, memInfo);
1446 /* unpack Route hdr last */
1447 CMCHKUNPK(oduUnpackBool, &unpkParam->rtOptsPrsnt, mBuf);
1448 if (unpkParam->rtOptsPrsnt)
1449 cmUnpkCmIpv6RtHdr(&unpkParam->rtOpts, mBuf, memInfo);
1452 } /* end of cmUnpkCmIpv6ExtHdr */
1457 * Fun: cmPkCmIpv6DestOptsArr
1459 * Desc: This function packs the IPV6 Destination Option array
1469 S16 cmPkCmIpv6DestOptsArr
1471 CmIpv6DestOptsArr *pkParam, /* IPV6 Dest hdr array */
1472 Buffer *mBuf /* message buffer */
1475 S16 cmPkCmIpv6DestOptsArr (pkParam, mBuf)
1476 CmIpv6DestOptsArr *pkParam; /* IPV6 Dest hdr array */
1477 Buffer *mBuf; /* message buffer */
1484 /* pack all HBH options */
1485 for(numOptions = 0; numOptions<pkParam->numDestOpts; numOptions++)
1486 CMCHKPK(cmPkCmIpv6DestOptsHdr, &pkParam->destOpts[numOptions], mBuf);
1487 CMCHKPK(oduUnpackUInt8, pkParam->numDestOpts, mBuf);
1490 } /* end of cmPkCmIpv6DestOptsArr */
1495 * Fun: cmPkCmIpv6DestOptsHdr
1497 * Desc: This function packs individua IPV6 Destination Option
1507 S16 cmPkCmIpv6DestOptsHdr
1509 CmIpv6DestOptsHdr *pkParam, /* IPV6 Dest opt */
1510 Buffer *mBuf /* message buffer */
1513 S16 cmPkCmIpv6DestOptsHdr (pkParam, mBuf)
1514 CmIpv6DestOptsHdr *pkParam; /* IPV6 Dest opt */
1515 Buffer *mBuf; /* message buffer */
1521 for(optLen = 0; optLen < pkParam->length; optLen++)
1523 CMCHKPK(oduUnpackUInt8, pkParam->value[optLen], mBuf);
1525 CMCHKPK(oduUnpackUInt8, pkParam->length, mBuf);
1526 CMCHKPK(oduUnpackUInt8, pkParam->type, mBuf);
1529 } /* end of cmPkCmIpv6DestOptsHdr */
1534 * Fun: cmUnpkCmIpv6DestOptsHdr
1536 * Desc: This function unpacks individual IPV6 Dest Option
1546 S16 cmUnpkCmIpv6DestOptsHdr
1548 CmIpv6DestOptsHdr *unpkParam,/* IPV6 Dest Option */
1549 Buffer *mBuf, /* message buffer */
1550 Mem *memInfo /* meminfo to allocate mem for dest opt */
1553 S16 cmUnpkCmIpv6DestOptsHdr (unpkParam, mBuf, memInfo)
1554 CmIpv6DestOptsHdr *unpkParam;/* IPV6 Dest Option */
1555 Buffer *mBuf; /* message buffer */
1556 Mem *memInfo; /* meminfo to allocate mem for dest opt */
1559 S32 retVal; /* temporary return value */
1560 uint8_t optLen; /* length of value field */
1563 /* unpack type, length */
1564 CMCHKUNPK(oduPackUInt8, &unpkParam->type, mBuf);
1565 CMCHKUNPK(oduPackUInt8, &unpkParam->length, mBuf);
1567 /* allocate static memory to hold the unpacked values */
1568 retVal = SGetSBuf(memInfo->region,
1570 (Data **)&unpkParam->value, (Size)unpkParam->length);
1576 /* unpack value fieldof this option */
1577 for(optLen = 0; optLen<unpkParam->length; optLen++)
1579 CMCHKUNPK(oduPackUInt8, &unpkParam->value[optLen], mBuf);
1583 } /* end of cmUnpkCmIpv6DestOptsHdr */
1588 * Fun: cmUnpkCmIpv6DestOptsArr
1590 * Desc: This function unpacks the IPV6 Destination Option array
1600 S16 cmUnpkCmIpv6DestOptsArr
1602 CmIpv6DestOptsArr *unpkParam, /* all IPV6 Destination Options */
1603 Buffer *mBuf, /* message buffer */
1604 Mem *memInfo /* meminfo to allocate mem for dest opts */
1607 S16 cmUnpkCmIpv6DestOptsArr (unpkParam, mBuf, memInfo)
1608 CmIpv6DestOptsArr *unpkParam; /* all IPV6 Destination Options */
1609 Buffer *mBuf; /* message buffer */
1610 Mem *memInfo; /* meminfo to allocate mem for dest opts */
1617 CMCHKUNPK(oduPackUInt8, &unpkParam->numDestOpts, mBuf);
1618 if (unpkParam->numDestOpts)
1620 /* allocate mem to hold all dest options */
1621 retVal = SGetSBuf(memInfo->region,
1623 (Data **)&unpkParam->destOpts,
1624 (unpkParam->numDestOpts * sizeof(CmIpv6DestOptsHdr)));
1631 /* unpack all dest options */
1632 for(numOptions = 0; numOptions<unpkParam->numDestOpts; numOptions++)
1633 if ((retVal = cmUnpkCmIpv6DestOptsHdr(&unpkParam->destOpts[numOptions],
1634 mBuf, memInfo)) != ROK)
1639 } /* end of cmUnpkCmIpv6DestOptsArr */
1644 * Fun: cmPkCmIpv6HBHHdrArr
1646 * Desc: This function packs the all IPV6 HopByHop options
1656 S16 cmPkCmIpv6HBHHdrArr
1658 CmIpv6HBHHdrArr *pkParam, /* all IPV6 HopByHop options */
1659 Buffer *mBuf /* message buffer */
1662 S16 cmPkCmIpv6HBHHdrArr (pkParam, mBuf)
1663 CmIpv6HBHHdrArr *pkParam; /* IPV6 HopByHop options */
1664 Buffer *mBuf; /* message buffer */
1670 for(numOptions = 0; numOptions<pkParam->numHBHOpts; numOptions++)
1671 CMCHKPK(cmPkCmIpv6HBHHdr, &pkParam->hbhOpts[numOptions], mBuf);
1673 CMCHKPK(oduUnpackUInt8, pkParam->numHBHOpts, mBuf);
1676 } /* end of cmPkCmIpv6HBHHdrArr */
1681 * Fun: cmPkCmIpv6HBHHdr
1683 * Desc: This function packs individual IPV6 HBH options
1693 S16 cmPkCmIpv6HBHHdr
1695 CmIpv6HBHHdr *pkParam, /* individual IPV6 HBH options */
1696 Buffer *mBuf /* message buffer */
1699 S16 cmPkCmIpv6HBHHdr (pkParam, mBuf)
1700 CmIpv6HBHHdr *pkParam; /* individual IPV6 HBH options */
1701 Buffer *mBuf; /* message buffer */
1707 /* pack value field */
1708 for(optLen = 0; optLen<pkParam->length; optLen++)
1710 CMCHKPK(oduUnpackUInt8, pkParam->value[optLen], mBuf);
1713 /* pack type, length fields */
1714 CMCHKPK(oduUnpackUInt8, pkParam->length, mBuf);
1715 CMCHKPK(oduUnpackUInt8, pkParam->type, mBuf);
1718 } /* end of cmPkCmIpv6HBHHdr */
1723 * Fun: cmUnpkCmIpv6HBHHdr
1725 * Desc: This function unpacks individual IPV6 HBH Option
1735 S16 cmUnpkCmIpv6HBHHdr
1737 CmIpv6HBHHdr *unpkParam,/* individual IPV6 HBH Option */
1738 Buffer *mBuf, /* message buffer */
1739 Mem *memInfo /* meminfo to allocate mem for HBH opt */
1742 S16 cmUnpkCmIpv6HBHHdr (unpkParam, mBuf, memInfo)
1743 CmIpv6HBHHdr *unpkParam;/* individual IPV6 HBH Option */
1744 Buffer *mBuf; /* message buffer */
1745 Mem *memInfo; /* meminfo to allocate mem for HBH opt */
1748 S32 retVal; /* temporary return value */
1749 uint8_t optLen; /* length of value field */
1752 CMCHKUNPK(oduPackUInt8, &unpkParam->type, mBuf);
1753 CMCHKUNPK(oduPackUInt8, &unpkParam->length, mBuf);
1755 /* allocate static memory to hold the unpacked values */
1756 if (unpkParam->length)
1758 retVal = SGetSBuf(memInfo->region,
1760 (Data **)&unpkParam->value, (Size)unpkParam->length);
1766 for(optLen = 0; optLen<unpkParam->length; optLen++)
1767 CMCHKUNPK(oduPackUInt8, &unpkParam->value[optLen], mBuf);
1771 } /* end of cmUnpkCmIpv6HBHHdr */
1776 * Fun: cmUnpkCmIpv6HBHHdrArr
1778 * Desc: This function unpacks all IPV6 HopByHop options
1788 S16 cmUnpkCmIpv6HBHHdrArr
1790 CmIpv6HBHHdrArr *unpkParam, /* all HBH options */
1791 Buffer *mBuf, /* message buffer */
1792 Mem *memInfo /* meminfo to allocate space for HBH opt */
1795 S16 cmUnpkCmIpv6HBHHdrArr (unpkParam, mBuf, memInfo)
1796 CmIpv6HBHHdrArr *unpkParam; /* all HBH options */
1797 Buffer *mBuf; /* message buffer */
1798 Mem *memInfo; /* meminfo to allocate space for HBH opt */
1805 CMCHKUNPK(oduPackUInt8, &unpkParam->numHBHOpts, mBuf);
1806 if (unpkParam->numHBHOpts)
1808 /* allocate space for all HBH options */
1809 retVal = SGetSBuf(memInfo->region,
1811 (Data **)&unpkParam->hbhOpts,
1812 (unpkParam->numHBHOpts * sizeof(CmIpv6HBHHdr)));
1819 for(numOptions = 0; numOptions<unpkParam->numHBHOpts; numOptions++)
1820 cmUnpkCmIpv6HBHHdr(&unpkParam->hbhOpts[numOptions], mBuf, memInfo);
1823 } /* end of cmUnpkCmIpv6HBHHdrArr */
1824 #endif /* IPV6_OPTS_SUPPORTED */
1829 * Fun: cmUnpkCmIPHdrParm
1831 * Desc: This function unpacks the IP header parameters
1842 #ifdef IPV6_OPTS_SUPPORTED
1843 S16 cmUnpkCmIpHdrParm
1845 CmIpHdrParm *unpkParam,/* ip hdr parameters */
1846 Buffer *mBuf, /* message buffer */
1847 Mem *memInfo /* meminfo to allocate mem for ipHdrParam */
1850 S16 cmUnpkCmIpHdrParm
1852 CmIpHdrParm *unpkParam,/* ip hdr parameters */
1853 Buffer *mBuf /* message buffer */
1855 #endif /* IPV6_OPTS_SUPPORTED */
1858 #ifdef IPV6_OPTS_SUPPORTED
1859 S16 cmUnpkCmIpHdrParm (unpkParam, mBuf, memInfo)
1860 CmIpHdrParm *unpkParam;/* ip hdr parameters */
1861 Buffer *mBuf; /* message buffer */
1862 Mem *memInfo; /* meminfo to allocate mem for ipHdrParam */
1864 S16 cmUnpkCmIpHdrParm (unpkParam, mBuf)
1865 CmIpHdrParm *unpkParam;/* ip hdr parameters */
1866 Buffer *mBuf; /* message buffer */
1867 #endif /* IPV6_OPTS_SUPPORTED */
1871 CMCHKUNPK(oduPackUInt8, &unpkParam->type, mBuf);
1873 switch (unpkParam->type)
1875 case CM_HDRPARM_NOTPRSNT:
1876 case CM_HDRPARM_ICMP6:
1879 case CM_HDRPARM_IPV4:
1880 CMCHKUNPK(cmUnpkTknUInt8, &unpkParam->u.hdrParmIpv4.proto, mBuf);
1881 CMCHKUNPK(cmUnpkTknUInt8, &unpkParam->u.hdrParmIpv4.dfBit, mBuf);
1882 CMCHKUNPK(cmUnpkTknUInt8, &unpkParam->u.hdrParmIpv4.tos, mBuf);
1883 CMCHKUNPK(cmUnpkTknUInt8, &unpkParam->u.hdrParmIpv4.ttl, mBuf);
1884 #ifdef IPV4_OPTS_SUPPORTED
1885 CMCHKUNPK(cmUnpkTknStr64, &unpkParam->u.hdrParmIpv4.ipv4HdrOpt, mBuf);
1886 #endif /* IPV4_OPTS_SUPPORTED */
1889 case CM_HDRPARM_IPV6:
1890 #ifdef IPV6_SUPPORTED
1891 CMCHKUNPK(cmUnpkTknUInt8, &unpkParam->u.hdrParmIpv6.ttl, mBuf);
1893 CMCHKUNPK(cmUnpkCmNetAddr,
1894 &unpkParam->u.hdrParmIpv6.srcAddr6, mBuf);
1896 #ifdef IPV6_OPTS_SUPPORTED
1897 /* memInfo is passed forward to alloc mem to hold unpacked
1898 * IPV6 etx hdr data */
1899 cmUnpkCmIpv6ExtHdr(&unpkParam->u.hdrParmIpv6.ipv6ExtHdr,
1901 #endif /* IPV6_OPTS_SUPPORTED */
1902 #endif /* IPV6_SUPPORTED */
1910 } /* End of cmUnpkCmIpHdrParm */
1915 * Fun: cmPkCmIcmpFilter
1917 * Desc: This function packs the ICMP filter parameters
1927 S16 cmPkCmIcmpFilter
1929 CmIcmpFilter *pkParam,
1930 Buffer *mBuf /* message buffer */
1933 S16 cmPkCmIcmpFilter (pkParam, mBuf)
1934 CmIcmpFilter *pkParam;
1935 Buffer *mBuf; /* message buffer */
1938 /* Variable declaration */
1942 switch (pkParam->type)
1944 case CM_ICMP_NO_FILTER:
1947 case CM_ICMPVER4_FILTER:
1948 for(idx = (pkParam->u.icmpv4Filter.num-1); idx >= 0; idx--)
1950 CMCHKPK(oduUnpackUInt32, pkParam->u.icmpv4Filter.icmpError[idx].errCodeMask,
1952 CMCHKPK(oduUnpackUInt8, pkParam->u.icmpv4Filter.icmpError[idx].errType,
1955 CMCHKPK(oduUnpackUInt8, pkParam->u.icmpv4Filter.num, mBuf);
1956 CMCHKPK(oduUnpackUInt8, pkParam->u.icmpv4Filter.protocol, mBuf);
1957 CMCHKPK(oduUnpackUInt8, pkParam->u.icmpv4Filter.allMsg, mBuf);
1958 CMCHKPK(oduUnpackUInt8, pkParam->u.icmpv4Filter.icmpMsgFlag, mBuf);
1961 case CM_ICMPVER6_FILTER:
1962 /* The structure is yet to be decided */
1963 /* CMCHKPK(cmPkCmIpv6HdrParm, &pkParam->u.ipv6HdrParm, mBuf); */
1964 #ifdef IPV6_SUPPORTED
1965 for(idx = (pkParam->u.icmpv6Filter.num - 1); idx >= 0; idx--)
1967 CMCHKPK(oduUnpackUInt32, pkParam->u.icmpv6Filter.icmpError[idx].errCodeMask,
1969 CMCHKPK(oduUnpackUInt8, pkParam->u.icmpv6Filter.icmpError[idx].errType,
1972 CMCHKPK(oduUnpackUInt8, pkParam->u.icmpv6Filter.num, mBuf);
1973 CMCHKPK(oduUnpackUInt8, pkParam->u.icmpv4Filter.allMsg, mBuf);
1974 CMCHKPK(oduUnpackUInt8, pkParam->u.icmpv4Filter.icmpMsgFlag, mBuf);
1975 #endif /* IPV6_SUPPORTED */
1981 CMCHKPK(oduUnpackUInt8, pkParam->type, mBuf);
1989 * Fun: cmUnpkCmIcmpFilter
1991 * Desc: This function unpacks the
2001 S16 cmUnpkCmIcmpFilter
2003 CmIcmpFilter *unpkParam,
2004 Buffer *mBuf /* message buffer */
2007 S16 cmUnpkCmIcmpFilter (unpkParam, mBuf)
2008 CmIcmpFilter *unpkParam;
2009 Buffer *mBuf; /* message buffer */
2012 /* Variable declaration */
2015 CMCHKUNPK(oduPackUInt8, &unpkParam->type, mBuf);
2017 switch (unpkParam->type)
2019 case CM_ICMP_NO_FILTER:
2022 case CM_ICMPVER4_FILTER:
2023 CMCHKUNPK(oduPackUInt8, &unpkParam->u.icmpv4Filter.icmpMsgFlag, mBuf);
2024 CMCHKUNPK(oduPackUInt8, &unpkParam->u.icmpv4Filter.allMsg, mBuf);
2025 CMCHKUNPK(oduPackUInt8, &unpkParam->u.icmpv4Filter.protocol, mBuf);
2026 CMCHKUNPK(oduPackUInt8, &unpkParam->u.icmpv4Filter.num, mBuf);
2028 for(idx = 0; idx < (unpkParam->u.icmpv4Filter.num); idx++)
2030 CMCHKUNPK(oduPackUInt8,
2031 &unpkParam->u.icmpv4Filter.icmpError[idx].errType, mBuf);
2032 CMCHKUNPK(oduPackUInt32,
2033 &unpkParam->u.icmpv4Filter.icmpError[idx].errCodeMask,
2038 case CM_ICMPVER6_FILTER:
2039 #ifdef IPV6_SUPPORTED
2040 CMCHKUNPK(oduPackUInt8, &unpkParam->u.icmpv6Filter.icmpMsgFlag, mBuf);
2041 CMCHKUNPK(oduPackUInt8, &unpkParam->u.icmpv6Filter.allMsg, mBuf);
2042 CMCHKUNPK(oduPackUInt8, &unpkParam->u.icmpv6Filter.num, mBuf);
2044 for(idx = 0; idx < (unpkParam->u.icmpv6Filter.num); idx++)
2046 CMCHKUNPK(oduPackUInt8,
2047 &unpkParam->u.icmpv6Filter.icmpError[idx].errType, mBuf);
2048 CMCHKUNPK(oduPackUInt32,
2049 &unpkParam->u.icmpv6Filter.icmpError[idx].errCodeMask,
2052 #endif /* IPV6_SUPPORTED */
2061 } /* End of cmUnpkCmIcmpFilter */
2063 #endif /* CM_INET2 */
2066 #endif /* if(LCHCT || LCHIT || LCLHC || LCHRT || LCLHR) */
2069 /********************************************************************30**
2071 *********************************************************************31*/