1998-03-11 21:11:04 +00:00
/*
2002-01-30 06:08:46 +00:00
* Unix SMB / CIFS implementation .
1998-03-11 21:11:04 +00: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-06 22:27:55 +00:00
* Copyright ( C ) Gerald ( Jerry ) Carter 2005
1998-03-11 21:11:04 +00: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 19:25:36 +00:00
* the Free Software Foundation ; either version 3 of the License , or
1998-03-11 21:11:04 +00: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 05:23:25 +00:00
* along with this program ; if not , see < http : //www.gnu.org/licenses/>.
1998-03-11 21:11:04 +00:00
*/
# include "includes.h"
2002-07-15 10:35:28 +00:00
# undef DBGC_CLASS
# define DBGC_CLASS DBGC_RPC_PARSE
1998-03-11 21:11:04 +00:00
/*******************************************************************
1999-12-13 13:27:58 +00:00
Reads or writes an NTTIME structure .
1998-03-11 21:11:04 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2007-10-18 17:40:25 -07:00
bool smb_io_time ( const char * desc , NTTIME * nttime , prs_struct * ps , int depth )
1998-03-11 21:11:04 +00:00
{
2006-09-06 18:32:20 +00:00
uint32 low , high ;
1999-12-13 13:27:58 +00:00
if ( nttime = = NULL )
return False ;
1998-03-11 21:11:04 +00:00
prs_debug ( ps , depth , desc , " smb_io_time " ) ;
depth + + ;
1999-12-13 13:27:58 +00:00
if ( ! prs_align ( ps ) )
return False ;
2007-10-10 15:34:30 -05:00
2006-09-17 20:28:46 +00:00
if ( MARSHALLING ( ps ) ) {
low = * nttime & 0xFFFFFFFF ;
high = * nttime > > 32 ;
}
1998-03-11 21:11:04 +00:00
2006-09-06 18:32:20 +00:00
if ( ! prs_uint32 ( " low " , ps , depth , & low ) ) /* low part */
1999-12-13 13:27:58 +00:00
return False ;
2006-09-06 18:32:20 +00:00
if ( ! prs_uint32 ( " high " , ps , depth , & high ) ) /* high part */
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
2006-09-17 20:28:46 +00:00
if ( UNMARSHALLING ( ps ) ) {
* nttime = ( ( ( uint64_t ) high < < 32 ) + low ) ;
}
2006-09-06 18:32:20 +00:00
1999-10-15 18:46:22 +00:00
return True ;
1998-03-11 21:11:04 +00:00
}
2004-04-13 14:39:48 +00:00
/*******************************************************************
2006-09-19 00:12:11 +00:00
Reads or writes a struct GUID
2004-04-13 14:39:48 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2007-10-18 17:40:25 -07:00
bool smb_io_uuid ( const char * desc , struct GUID * uuid ,
2004-04-13 14:39:48 +00: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 ;
}