1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 // ---------------------------------------------------------------------- 19 // 20 // This Software is an original work of authorship of PacketVideo Corporation. 21 // Portions of the Software were developed in collaboration with NTT DoCoMo, 22 // Inc. or were derived from the public domain or materials licensed from 23 // third parties. Title and ownership, including all intellectual property 24 // rights in and to the Software shall remain with PacketVideo Corporation 25 // and NTT DoCoMo, Inc. 26 // 27 // ----------------------------------------------------------------------- 28 /************************************************************************/ 29 /* file name : serme.c */ 30 /* file contents : Request Multiplex Entry */ 31 /* : Signalling Entity Management */ 32 /* draw : '96.11.26 */ 33 /*----------------------------------------------------------------------*/ 34 /* amendment : */ 35 /* Copyright (C) 1996 NTT DoCoMo */ 36 /************************************************************************/ 37 38 39 /************************************************************************/ 40 /* Headerfile Include */ 41 /************************************************************************/ 42 #include "h245inf.h" 43 #include "semsgque.h" 44 #include "rme.h" 45 46 47 /************************************************************************/ 48 /* function name : Se_Rme_0600_0000 */ 49 /* function outline : Event SEND.request */ 50 /* : Status Outgoing Idle */ 51 /* function discription: void Se_Rme_0600_0000( void ) */ 52 /* input data : None */ 53 /* output data : None */ 54 /* draw time : '96.11.19 */ 55 /*----------------------------------------------------------------------*/ 56 /* amendent career (x) : */ 57 /* */ 58 /* Copyright (C) 1996 NTT DoCoMo */ 59 /************************************************************************/ 60 void RME::_0600_0000(void) 61 { 62 StatusWrite(RME_OUTGOING_AWTING_RPS) ; 63 MsgEntrySend() ; 64 T107TimerStart() ; 65 } 66 67 68 /************************************************************************/ 69 /* function name : Se_Rme_0601_0001 */ 70 /* function outline : Event RequestMultiplexEntry */ 71 /* : Status Incoming Idle */ 72 /* function discription: void Se_Rme_0601_0001( */ 73 /* PS_RequestMultiplexEntry ) */ 74 /* input data : PS_RequestMultiplexEntry */ 75 /* pRequestMultiplexEntry */ 76 /* output data : None */ 77 /* draw time : '96.11.19 */ 78 /*----------------------------------------------------------------------*/ 79 /* amendent career (x) : */ 80 /* */ 81 /* Copyright (C) 1996 NTT DoCoMo */ 82 /************************************************************************/ 83 void RME::_0601_0001(PS_RequestMultiplexEntry pRequestMultiplexEntry) 84 { 85 InRMEntries.Write(pRequestMultiplexEntry->size_of_entryNumbers, 86 pRequestMultiplexEntry->entryNumbers); 87 StatusWrite(RME_INCOMING_AWTING_RPS) ; 88 PtvSendIndSend() ; 89 } 90 91 92 /************************************************************************/ 93 /* function name : Se_Rme_0601_0011 */ 94 /* function outline : Event RequestMultiplexEntry */ 95 /* : Status Incoming Awaiting Response */ 96 /* function discription: void Se_Rme_0601_0011( */ 97 /* PS_RequestMultiplexEntry ) */ 98 /* input data : PS_RequestMultiplexEntry */ 99 /* pRequestMultiplexEntry */ 100 /* output data : None */ 101 /* draw time : '96.11.19 */ 102 /*----------------------------------------------------------------------*/ 103 /* amendent career (x) : */ 104 /* */ 105 /* Copyright (C) 1996 NTT DoCoMo */ 106 /************************************************************************/ 107 void RME::_0601_0011(PS_RequestMultiplexEntry pRequestMultiplexEntry) 108 { 109 S_RmeRejectCause cause; 110 111 cause.index = 0 ; /* unspecifiedCause */ 112 PtvRjtIdcSend(Src_USER , &cause) ; 113 InRMEntries.Write(pRequestMultiplexEntry->size_of_entryNumbers, 114 pRequestMultiplexEntry->entryNumbers); 115 116 PtvSendIndSend() ; 117 } 118 119 120 /************************************************************************/ 121 /* function name : Se_Rme_0602_0011 */ 122 /* function outline : Event SEND.response */ 123 /* : Status Incoming Awaiting Response */ 124 /* function discription: void Se_Rme_0602_0011( void ) */ 125 /* input data : None */ 126 /* output data : None */ 127 /* draw time : '96.11.19 */ 128 /*----------------------------------------------------------------------*/ 129 /* amendent career (x) : */ 130 /* */ 131 /* Copyright (C) 1996 NTT DoCoMo */ 132 /************************************************************************/ 133 void RME::_0602_0011(void) 134 { 135 StatusWrite(RME_INCOMING_IDLE) ; 136 MsgEntryAckSend() ; 137 } 138 139 140 /************************************************************************/ 141 /* function name : Se_Rme_0603_0011 */ 142 /* function outline : Event REJECT.request */ 143 /* : Status Incoming Awaiting Response */ 144 /* function discription: void Se_Rme_0603_0011( PS_RmeRejectCause ) */ 145 /* input data : PS_RmeRejectCause pCause_Rme */ 146 /* output data : None */ 147 /* draw time : '96.11.19 */ 148 /*----------------------------------------------------------------------*/ 149 /* amendent career (x) : */ 150 /* */ 151 /* Copyright (C) 1996 NTT DoCoMo */ 152 /************************************************************************/ 153 void RME::_0603_0011(PS_RmeRejectCause pCause_Rme) 154 { 155 StatusWrite(RME_INCOMING_IDLE) ; 156 MsgEntryRjtSend(pCause_Rme) ; 157 } 158 159 160 /************************************************************************/ 161 /* function name : Se_Rme_0604_0010 */ 162 /* function outline : Event RequestMultiplexEntryAck */ 163 /* : Status Outgoing Awaiting Response */ 164 /* function discription: void Se_Rme_0604_0010( */ 165 /* PS_RequestMultiplexEntryAck ) */ 166 /* input data : PS_RequestMultiplexEntryAck */ 167 /* pRequestMultiplexEntryAck */ 168 /* output data : None */ 169 /* draw time : '96.11.19 */ 170 /*----------------------------------------------------------------------*/ 171 /* amendent career (x) : */ 172 /* */ 173 /* Copyright (C) 1996 NTT DoCoMo */ 174 /************************************************************************/ 175 void RME::_0604_0010(PS_RequestMultiplexEntryAck pRequestMultiplexEntryAck) 176 { 177 OSCL_UNUSED_ARG(pRequestMultiplexEntryAck); 178 T107TimerStop() ; 179 StatusWrite(RME_OUTGOING_IDLE) ; 180 PtvSendCfmSend() ; 181 } 182 183 184 /************************************************************************/ 185 /* function name : Se_Rme_0605_0010 */ 186 /* function outline : Event RequestMultiplexEntryReject */ 187 /* : Status Outgoing Awaiting Response */ 188 /* function discription: void Se_Rme_0605_0010 */ 189 /* : ( PS_RequestMultiplexEntryReject ) */ 190 /* input data : PS_RequestMultiplexEntryReject */ 191 /* pRequestMultiplexEntryReject */ 192 /* output data : None */ 193 /* draw time : '96.11.19 */ 194 /*----------------------------------------------------------------------*/ 195 /* amendent career (x) : */ 196 /* */ 197 /* Copyright (C) 1996 NTT DoCoMo */ 198 /************************************************************************/ 199 void RME::_0605_0010(PS_RequestMultiplexEntryReject pRequestMultiplexEntryReject) 200 { 201 T107TimerStop() ; 202 StatusWrite(RME_OUTGOING_IDLE) ; 203 PtvRjtIdcSend(Src_USER , &pRequestMultiplexEntryReject->rejectionDescriptions->rmeRejectCause) ; 204 } 205 206 207 /************************************************************************/ 208 /* function name : Se_Rme_0606_0010 */ 209 /* function outline : Event Timer T107 Timeout */ 210 /* : Status Outgoing Awaiting Response */ 211 /* function discription: void Se_Rme_0606_0010( int32 ) */ 212 /* input data : int32 Timer_Sequence_Number */ 213 /* output data : None */ 214 /* draw time : '96.11.19 */ 215 /*----------------------------------------------------------------------*/ 216 /* amendent career (x) : */ 217 /* */ 218 /* Copyright (C) 1996 NTT DoCoMo */ 219 /************************************************************************/ 220 void RME::_0606_0010(int32 Timer_Sequence_Number) 221 { 222 S_RmeRejectCause cause; 223 224 if (Timer_Sequence_Number == TmrSqcNumberRead()) /* Receive Timer Sequense Number Equal Timer Sequence Number */ 225 { 226 StatusWrite(RME_OUTGOING_IDLE) ; 227 MsgEntryRlsSend() ; 228 cause.index = 0 ; /* unspecifiedCause */ 229 PtvRjtIdcSend(Src_PROTOCOL , &cause) ; 230 } 231 } 232 233 /************************************************************************/ 234 /* function name : Se_Rme_0607_0011 */ 235 /* function outline : Event RequestMultiplexEntryRelease */ 236 /* : Status Incoming Awaiting Response */ 237 /* function discription: void Se_Rme_0607_0011( void ) */ 238 /* input data : None */ 239 /* output data : None */ 240 /* draw time : '96.11.19 */ 241 /*----------------------------------------------------------------------*/ 242 /* amendent career (x) : */ 243 /* */ 244 /* Copyright (C) 1996 NTT DoCoMo */ 245 /************************************************************************/ 246 void RME::_0607_0011(PS_RequestMultiplexEntryRelease pRequestMultiplexEntryRelease) 247 { 248 S_RmeRejectCause cause; 249 250 OSCL_UNUSED_ARG(pRequestMultiplexEntryRelease); 251 252 cause.index = 0 ; /* unspecifiedCause */ 253 StatusWrite(RME_INCOMING_IDLE) ; 254 PtvRjtIdcSend(Src_PROTOCOL , &cause) ; 255 } 256 257 258 /************************************************************************/ 259 /* function name : Se_RmeMsgEntrySend */ 260 /* function outline : RequestMultiplexEntry Send */ 261 /* function discription: void Se_RmeMsgEntrySend( void ) */ 262 /* input data : None */ 263 /* output data : None */ 264 /* draw time : '96.11.19 */ 265 /*----------------------------------------------------------------------*/ 266 /* amendent career (x) : */ 267 /* */ 268 /* Copyright (C) 1996 NTT DoCoMo */ 269 /************************************************************************/ 270 void RME::MsgEntrySend(void) 271 { 272 S_RequestMultiplexEntry requestMultiplexEntry; 273 uint32 entryNumbers[15]; 274 S_H245Msg h245Msg; 275 276 requestMultiplexEntry.size_of_entryNumbers = (uint16) OutRMEntries.SizeRead(); 277 OutRMEntries.EntriesCopy(entryNumbers); 278 requestMultiplexEntry.entryNumbers = entryNumbers; 279 280 h245Msg.Type1 = H245_MSG_REQ ; 281 h245Msg.Type2 = MSGTYP_RME ; 282 h245Msg.pData = (uint8*) & requestMultiplexEntry ; 283 284 MessageSend(&h245Msg) ; 285 } 286 287 288 /************************************************************************/ 289 /* function name : Se_RmeMsgEntryAckSend */ 290 /* function outline : RequestMultiplexEntryAck Send */ 291 /* function discription: void Se_RmeMsgEntryAckSend( void ) */ 292 /* input data : None */ 293 /* output data : None */ 294 /* draw time : '96.11.19 */ 295 /*----------------------------------------------------------------------*/ 296 /* amendent career (x) : */ 297 /* */ 298 /* Copyright (C) 1996 NTT DoCoMo */ 299 /************************************************************************/ 300 void RME::MsgEntryAckSend(void) 301 { 302 S_RequestMultiplexEntryAck requestMultiplexEntryAck ; 303 uint32 entryNumbers[15]; 304 S_H245Msg h245Msg ; 305 306 requestMultiplexEntryAck.size_of_entryNumbers = (uint16) InRMEntries.SizeRead(); 307 InRMEntries.EntriesCopy(entryNumbers); 308 requestMultiplexEntryAck.entryNumbers = entryNumbers; 309 310 h245Msg.Type1 = H245_MSG_RPS ; 311 h245Msg.Type2 = MSGTYP_RME_ACK ; 312 h245Msg.pData = (uint8*) & requestMultiplexEntryAck ; 313 314 MessageSend(&h245Msg) ; 315 316 return ; 317 } 318 319 320 /************************************************************************/ 321 /* function name : Se_RmeMsgEntryRjtSend */ 322 /* function outline : RequestMultiplexEntryReject Send */ 323 /* function discription: void Se_RmeMsgEntryRjtSend( PS_RmeRejectCause ) */ 324 /* input data : PS_RmeRejectCause pCause_rmese */ 325 /* output data : None */ 326 /* draw time : '96.11.19 */ 327 /*----------------------------------------------------------------------*/ 328 /* amendent career (x) : */ 329 /* */ 330 /* Copyright (C) 1996 NTT DoCoMo */ 331 /************************************************************************/ 332 void RME::MsgEntryRjtSend(PS_RmeRejectCause pCause_rmese) 333 { 334 S_RequestMultiplexEntryReject requestMultiplexEntryReject ; 335 uint32 entryNumbers[15]; 336 S_RequestMultiplexEntryRejectionDescriptions requestMultiplexEntryRejectionDescriptions ; 337 S_H245Msg h245Msg ; 338 339 requestMultiplexEntryReject.size_of_entryNumbers = (uint16) InRMEntries.SizeRead(); 340 InRMEntries.EntriesCopy(entryNumbers); 341 requestMultiplexEntryReject.entryNumbers = entryNumbers; 342 343 requestMultiplexEntryReject.size_of_rejectionDescriptions = 1 ; 344 345 requestMultiplexEntryRejectionDescriptions.multiplexTableEntryNumber = 1 ; 346 oscl_memcpy((int8*)&requestMultiplexEntryRejectionDescriptions.rmeRejectCause , 347 (int8*)pCause_rmese, sizeof(S_RmeRejectCause)) ; 348 349 requestMultiplexEntryReject.rejectionDescriptions = &requestMultiplexEntryRejectionDescriptions ; 350 351 h245Msg.Type1 = H245_MSG_RPS ; 352 h245Msg.Type2 = MSGTYP_RME_RJT ; 353 h245Msg.pData = (uint8*) & requestMultiplexEntryReject ; 354 355 MessageSend(&h245Msg) ; 356 } 357 358 359 /************************************************************************/ 360 /* function name : Se_RmeMsgEntryRlsSend */ 361 /* function outline : RequestMultiplexEntryRelease Send */ 362 /* function discription: void Se_RmeMsgEntryRlsSend( void ) */ 363 /* input data : None */ 364 /* output data : None */ 365 /* draw time : '96.11.19 */ 366 /*----------------------------------------------------------------------*/ 367 /* amendent career (x) : */ 368 /* */ 369 /* Copyright (C) 1996 NTT DoCoMo */ 370 /************************************************************************/ 371 void RME::MsgEntryRlsSend(void) 372 { 373 S_RequestMultiplexEntryRelease requestMultiplexEntryRelease; 374 uint32 entryNumbers[15]; 375 S_H245Msg h245Msg; 376 377 requestMultiplexEntryRelease.size_of_entryNumbers = (uint16) OutRMEntries.SizeRead(); 378 OutRMEntries.EntriesCopy(entryNumbers); 379 requestMultiplexEntryRelease.entryNumbers = entryNumbers; 380 381 h245Msg.Type1 = H245_MSG_IDC ; 382 h245Msg.Type2 = MSGTYP_RME_RLS ; 383 h245Msg.pData = (uint8*) & requestMultiplexEntryRelease ; 384 385 MessageSend(&h245Msg) ; 386 } 387 388 389 /************************************************************************/ 390 /* function name : Se_RmePtvSendIndSend */ 391 /* function outline : SEND.indicaton Send */ 392 /* function discription: void Se_RmePtvSendIndSend( void ) */ 393 /* input data : None */ 394 /* output data : None */ 395 /* draw time : '96.11.19 */ 396 /*----------------------------------------------------------------------*/ 397 /* amendent career (x) : */ 398 /* */ 399 /* Copyright (C) 1996 NTT DoCoMo */ 400 /************************************************************************/ 401 void RME::PtvSendIndSend(void) 402 { 403 S_InfHeader header ; 404 405 header.InfType = H245_PRIMITIVE ; 406 header.InfId = E_PtvId_Rme_Send_Idc ; 407 header.InfSupplement1 = 0 ; 408 header.InfSupplement2 = 0 ; 409 header.pParameter = NULL ; 410 header.Size = 0 ; 411 412 PrimitiveSend(&header) ; 413 } 414 415 416 /************************************************************************/ 417 /* function name : PtvRjtIdcSend */ 418 /* function outline : REJECT.indication Send */ 419 /* function discription: void PtvRjtIdcSend( int32, */ 420 /* PS_RmeRejectCause ) */ 421 /* input data : int32 Source */ 422 /* : PS_RmeRejectCause pCause_rmese */ 423 /* output data : None */ 424 /* draw time : '96.11.19 */ 425 /*----------------------------------------------------------------------*/ 426 /* amendent career (x) : */ 427 /* */ 428 /* Copyright (C) 1996 NTT DoCoMo */ 429 /************************************************************************/ 430 void RME::PtvRjtIdcSend(int32 Source , PS_RmeRejectCause pCause) 431 { 432 S_InfHeader header ; 433 S_SourceCause_Rme sourceCause ; 434 435 sourceCause.Source = (ENUM_Source)Source ; 436 oscl_memcpy((int8*)&sourceCause.Cause , (int8*)pCause , sizeof(S_RmeRejectCause)) ; 437 438 header.InfType = H245_PRIMITIVE ; 439 header.InfId = E_PtvId_Rme_Rjt_Idc ; 440 header.InfSupplement1 = 0 ; 441 header.InfSupplement2 = 0 ; 442 header.pParameter = (uint8*) & sourceCause ; 443 header.Size = sizeof(S_SourceCause_Rme) ; 444 445 PrimitiveSend(&header) ; 446 } 447 448 449 /************************************************************************/ 450 /* function name : Se_RmePtvSendCfmSend */ 451 /* function outline : SEND.confirm Send */ 452 /* function discription: void Se_RmePtvSendCfmSend( void ) */ 453 /* input data : None */ 454 /* output data : None */ 455 /* draw time : '96.11.19 */ 456 /*----------------------------------------------------------------------*/ 457 /* amendent career (x) : */ 458 /* */ 459 /* Copyright (C) 1996 NTT DoCoMo */ 460 /************************************************************************/ 461 void RME::PtvSendCfmSend(void) 462 { 463 S_InfHeader header ; 464 465 header.InfType = H245_PRIMITIVE ; 466 header.InfId = E_PtvId_Rme_Send_Cfm ; 467 header.InfSupplement1 = 0 ; 468 header.InfSupplement2 = 0 ; 469 header.pParameter = NULL ; 470 header.Size = 0 ; 471 472 PrimitiveSend(&header) ; 473 } 474 475 476 #ifdef PVANALYZER /* --------SE Analyzer Tool -------- */ 477 478 #define ANALYZER_SE 0x0020 // (Assume tag is fixed) 479 void Show245(uint16 tag, uint16 indent, char *inString); 480 481 // ========================================================= 482 // Se_RmeStatusShow() 483 // 484 // This function displays state transition information for 485 // the RME signaling entity. 486 // ========================================================= 487 void RME::StatusShow(uint8 oldStatus, uint8 newStatus) 488 { 489 char tempString[80]; 490 491 Show245(ANALYZER_SE, 0, "RMESE State Transition:"); 492 sprintf(tempString, " from--> %s", StateLabel(oldStatus)); 493 Show245(ANALYZER_SE, 0, tempString); 494 sprintf(tempString, " to--> %s", StateLabel(newStatus)); 495 Show245(ANALYZER_SE, 0, tempString); 496 Show245(ANALYZER_SE, 0, " "); 497 } 498 499 // ========================================================== 500 // Se_RmeStateLabel() 501 // 502 // Returns a pointer to an approprate state label string. 503 // ========================================================== 504 char* RME::StateLabel(uint8 status) 505 { 506 switch (status) 507 { 508 case RME_OUTGOING_IDLE: 509 return("Outgoing IDLE"); 510 break; 511 case RME_OUTGOING_AWTING_RPS: 512 return("Outgoing AWAITING RESPONSE"); 513 break; 514 case RME_INCOMING_IDLE: 515 return("Incoming IDLE"); 516 break; 517 case RME_INCOMING_AWTING_RPS: 518 return("Incoming AWAITING RESPONSE"); 519 break; 520 default: 521 return("UNKNOWN STATE"); 522 } 523 } 524 #endif /* --------------------------------- */ 525 526 527 528 /************************************************************************/ 529 /* function name : Se_RmeT107TimerStart */ 530 /* function outline : T107 Timer Start */ 531 /* function discription: void Se_RmeT107TimerStart( void ) */ 532 /* input data : None */ 533 /* output data : None */ 534 /* draw time : '96.11.26 */ 535 /*----------------------------------------------------------------------*/ 536 /* amendent career (x) : */ 537 /* */ 538 /* Copyright (C) 1996 NTT DoCoMo */ 539 /************************************************************************/ 540 void RME::T107TimerStart(void) 541 { 542 TmrSqcNumberInc() ; 543 RequestTimer(E_TmrId_Rme_T107 , TmrSqcNumberRead() , 544 TimerDuration) ; 545 } 546 547 548 /************************************************************************/ 549 /* function name : Se_RmeT107TimerStop */ 550 /* function outline : T107 Timer Stop */ 551 /* function discription: void Se_RmeT107TimerStop( void ) */ 552 /* input data : None */ 553 /* output data : None */ 554 /* draw time : '96.11.19 */ 555 /*----------------------------------------------------------------------*/ 556 /* amendent career (x) : */ 557 /* */ 558 /* Copyright (C) 1996 NTT DoCoMo */ 559 /************************************************************************/ 560 void RME::T107TimerStop(void) 561 { 562 CancelTimer(E_TmrId_Rme_T107) ; 563 } 564