//+-------------------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright (c) Microsoft Corporation. All rights reserved.
//
//  Component: WSDAPI - Microsoft Web Services for Devices API
// 
//  File: wsdattachment.idl
//
//  Abstract: Attachment interface definitions and typedefs for WSDAPI
//
//--------------------------------------------------------------------------

import "objidl.idl";

//
// Forward definitions
//
interface IWSDAttachment;
interface IWSDOutboundAttachment;
interface IWSDInboundAttachment;

cpp_quote("HRESULT WINAPI")
cpp_quote("WSDCreateOutboundAttachment(")
cpp_quote("    __deref_out IWSDOutboundAttachment** ppAttachment);")

//+-------------------------------------------------------------------------
//  IWSDAttachment Interface
//  Description: Base interface for inbound and outbound attachments
//--------------------------------------------------------------------------
[
    object,
    uuid(5d55a616-9df8-4b09-b156-9ba351a48b76)
]
interface IWSDAttachment : IUnknown
{
}

//+-------------------------------------------------------------------------
//  IWSDOutboundAttachment Interface
//  Description: Provides a way for applications to send attachment data
//--------------------------------------------------------------------------
[
    object,
    uuid(aa302f8d-5a22-4ba5-b392-aa8486f4c15d),
    local
]
interface IWSDOutboundAttachment : IWSDAttachment
{
    HRESULT Write(
        [in, size_is(dwBytesToWrite), annotation("__in_ecount(dwBytesToWrite)")] const BYTE* pBuffer,
        [in] DWORD dwBytesToWrite,
        [out, annotation("__out")] LPDWORD pdwNumberOfBytesWritten);

    HRESULT Close();

    HRESULT Abort();    
}

//+-------------------------------------------------------------------------
//  IWSDInboundAttachment Interface
//  Description: Provides a way for applications to receive attachment data
//--------------------------------------------------------------------------
[
    object,
    uuid(5bd6ca65-233c-4fb8-9f7a-2641619655c9),
    local
]
interface IWSDInboundAttachment : IWSDAttachment
{
    HRESULT Read(
        [out, size_is(dwBytesToRead), length_is(*pdwNumberOfBytesRead),
            annotation("__out_ecount_part(dwBytesToRead, *pdwNumberOfBytesRead)")] BYTE* pBuffer,
        [in] DWORD dwBytesToRead,
        [out] LPDWORD pdwNumberOfBytesRead);

    HRESULT Close();
}

