1 /** 2 * Copyright (C) 2022 The Android Open Source Project 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 express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /** \addtogroup RTP_Stack 18 * @{ 19 */ 20 21 #ifndef _RtpOsUtil_h_ 22 #define _RtpOsUtil_h_ 23 24 #include <stdlib.h> 25 #include <RtpPfDatatypes.h> 26 27 /** 28 * This is a wrapper class for os defined functions related to timestamp and network. 29 */ 30 class RtpOsUtil 31 { 32 private: 33 RtpOsUtil(); 34 ~RtpOsUtil(); 35 36 public: 37 /** 38 * It gets the Ntp time stamp 39 * 40 * @param pstNtpTime Calculated NTP Timestamp 41 */ 42 static RtpDt_Void GetNtpTime(tRTP_NTP_TIME& pstNtpTime); 43 44 /** 45 * Initializes pseudo-random number generator using system time as seed 46 */ 47 static RtpDt_Void Srand(); 48 49 /** 50 * Generates a pseudo-random integral number using a new seed. 51 * 52 * @return Random number 53 */ 54 static RtpDt_UInt32 Rand(); 55 56 /** 57 * converts the unsigned integer from network byte order to host byte order. 58 * 59 * @param uiNetlong Network byte order number 60 * @return host byte order converted number 61 */ 62 static RtpDt_UInt32 Ntohl(RtpDt_UInt32 uiNetlong); 63 64 /** 65 * It returns Random number between 0 and 1 66 * 67 * @return Generated random fraction 68 */ 69 static RtpDt_Double RRand(); 70 71 }; // end RtpOsUtil 72 73 #endif // _RtpOsUtil_h_ 74 75 /** @}*/ 76