1998-03-12 00:11:04 +03:00
/*
2002-01-30 09:08:46 +03:00
* Unix SMB / CIFS implementation .
1998-03-12 00:11:04 +03:00
* RPC Pipe client / server routines
* Copyright ( C ) Andrew Tridgell 1992 - 1997 ,
* Copyright ( C ) Luke Kenneth Casson Leighton 1996 - 1997 ,
* Copyright ( C ) Paul Ashton 1997.
2005-04-07 02:27:55 +04:00
* Copyright ( C ) Gerald ( Jerry ) Carter 2005
1998-03-12 00:11:04 +03:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
2007-07-09 23:25:36 +04:00
* the Free Software Foundation ; either version 3 of the License , or
1998-03-12 00:11:04 +03:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2007-07-10 09:23:25 +04:00
* along with this program ; if not , see < http : //www.gnu.org/licenses/>.
1998-03-12 00:11:04 +03:00
*/
# include "includes.h"
2002-07-15 14:35:28 +04:00
# undef DBGC_CLASS
# define DBGC_CLASS DBGC_RPC_PARSE
1998-03-12 00:11:04 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes an NTTIME structure .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
2007-10-19 04:40:25 +04:00
bool smb_io_time ( const char * desc , NTTIME * nttime , prs_struct * ps , int depth )
1998-03-12 00:11:04 +03:00
{
2006-09-06 22:32:20 +04:00
uint32 low , high ;
1999-12-13 16:27:58 +03:00
if ( nttime = = NULL )
return False ;
1998-03-12 00:11:04 +03:00
prs_debug ( ps , depth , desc , " smb_io_time " ) ;
depth + + ;
1999-12-13 16:27:58 +03:00
if ( ! prs_align ( ps ) )
return False ;
2007-10-11 00:34:30 +04:00
2006-09-18 00:28:46 +04:00
if ( MARSHALLING ( ps ) ) {
low = * nttime & 0xFFFFFFFF ;
high = * nttime > > 32 ;
}
1998-03-12 00:11:04 +03:00
2006-09-06 22:32:20 +04:00
if ( ! prs_uint32 ( " low " , ps , depth , & low ) ) /* low part */
1999-12-13 16:27:58 +03:00
return False ;
2006-09-06 22:32:20 +04:00
if ( ! prs_uint32 ( " high " , ps , depth , & high ) ) /* high part */
1999-12-13 16:27:58 +03:00
return False ;
1999-10-15 22:46:22 +04:00
2006-09-18 00:28:46 +04:00
if ( UNMARSHALLING ( ps ) ) {
* nttime = ( ( ( uint64_t ) high < < 32 ) + low ) ;
}
2006-09-06 22:32:20 +04:00
1999-10-15 22:46:22 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
2004-04-13 18:39:48 +04:00
/*******************************************************************
2006-09-19 04:12:11 +04:00
Reads or writes a struct GUID
2004-04-13 18:39:48 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2007-10-19 04:40:25 +04:00
bool smb_io_uuid ( const char * desc , struct GUID * uuid ,
2004-04-13 18:39:48 +04:00
prs_struct * ps , int depth )
{
if ( uuid = = NULL )
return False ;
prs_debug ( ps , depth , desc , " smb_io_uuid " ) ;
depth + + ;
if ( ! prs_uint32 ( " data " , ps , depth , & uuid - > time_low ) )
return False ;
if ( ! prs_uint16 ( " data " , ps , depth , & uuid - > time_mid ) )
return False ;
if ( ! prs_uint16 ( " data " , ps , depth , & uuid - > time_hi_and_version ) )
return False ;
if ( ! prs_uint8s ( False , " data " , ps , depth , uuid - > clock_seq , sizeof ( uuid - > clock_seq ) ) )
return False ;
if ( ! prs_uint8s ( False , " data " , ps , depth , uuid - > node , sizeof ( uuid - > node ) ) )
return False ;
return True ;
}