Index: trunk/include/iprt/mangling.h
===================================================================
--- trunk/include/iprt/mangling.h	(revision 89258)
+++ trunk/include/iprt/mangling.h	(revision 89264)
@@ -2021,5 +2021,7 @@
 # define RTSgBufCopy                                    RT_MANGLER(RTSgBufCopy)
 # define RTSgBufCopyFromBuf                             RT_MANGLER(RTSgBufCopyFromBuf)
+# define RTSgBufCopyFromFn                              RT_MANGLER(RTSgBufCopyFromFn)
 # define RTSgBufCopyToBuf                               RT_MANGLER(RTSgBufCopyToBuf)
+# define RTSgBufCopyToFn                                RT_MANGLER(RTSgBufCopyToFn)
 # define RTSgBufInit                                    RT_MANGLER(RTSgBufInit)
 # define RTSgBufIsZero                                  RT_MANGLER(RTSgBufIsZero)
Index: trunk/include/iprt/sg.h
===================================================================
--- trunk/include/iprt/sg.h	(revision 89258)
+++ trunk/include/iprt/sg.h	(revision 89264)
@@ -38,4 +38,33 @@
  * @{
  */
+
+/** Pointer to a const S/G entry. */
+typedef const struct RTSGBUF *PCRTSGBUF;
+
+/**
+ * Callback for RTSgBufCopyToFn() called on every segment of the given S/G buffer.
+ *
+ * @returns Number of bytes copied for this segment, a value smaller than cbSrc will stop the copy operation.
+ * @param   pSgBuf          The S/G buffer for reference.
+ * @param   pvSrc           Where to copy from.
+ * @param   cbSrc           The number of bytes in the source buffer.
+ * @param   pvUser          Opaque user data passed in RTSgBufCopyToFn().
+ */
+typedef DECLCALLBACKTYPE(size_t, FNRTSGBUFCOPYTO, (PCRTSGBUF pSgBuf, const void *pvSrc, size_t cbSrc, void *pvUser));
+/** Pointer to a FNRTSGBUFCOPYTO. */
+typedef FNRTSGBUFCOPYTO *PFNRTSGBUFCOPYTO;
+
+/**
+ * Callback for RTSgBufCopyFromFn() called on every segment of the given S/G buffer.
+ *
+ * @returns Number of bytes copied for this segment, a value smaller than cbDst will stop the copy operation.
+ * @param   pSgBuf          The S/G buffer for reference.
+ * @param   pvDst           Where to copy to.
+ * @param   cbDst           The number of bytes in the destination buffer.
+ * @param   pvUser          Opaque user data passed in RTSgBufCopyFromFn().
+ */
+typedef DECLCALLBACKTYPE(size_t, FNRTSGBUFCOPYFROM, (PCRTSGBUF pSgBuf, void *pvDst, size_t cbDst, void *pvUser));
+/** Pointer to a FNRTSGBUFCOPYFROM. */
+typedef FNRTSGBUFCOPYFROM *PFNRTSGBUFCOPYFROM;
 
 /**
@@ -82,6 +111,4 @@
 /** Pointer to a S/G entry. */
 typedef RTSGBUF *PRTSGBUF;
-/** Pointer to a const S/G entry. */
-typedef const RTSGBUF *PCRTSGBUF;
 /** Pointer to a S/G entry pointer. */
 typedef PRTSGBUF *PPRTSGBUF;
@@ -302,4 +329,30 @@
  */
 RTDECL(size_t) RTSgBufCopyFromBuf(PRTSGBUF pSgBuf, const void *pvBuf, size_t cbCopy);
+
+/**
+ * Copies data from the given S/G buffer to a destination handled by the given callback.
+ *
+ * @returns Number of bytes copied.
+ * @param   pSgBuf       The S/G buffer to copy from.
+ * @param   cbCopy       How many bytes to copy.
+ * @param   pfnCopyTo    The callback to call on every S/G buffer segment until the operation finished.
+ * @param   pvUser       Opaque user data to pass in the given callback.
+ *
+ * @note This operation advances the internal buffer pointer of the S/G buffer.
+ */
+RTDECL(size_t) RTSgBufCopyToFn(PRTSGBUF pSgBuf, size_t cbCopy, PFNRTSGBUFCOPYTO pfnCopyTo, void *pvUser);
+
+/**
+ * Copies data to the given S/G buffer from a destination handled by the given callback.
+ *
+ * @returns Number of bytes copied.
+ * @param   pSgBuf       The S/G buffer to copy to.
+ * @param   cbCopy       How many bytes to copy.
+ * @param   pfnCopyFrom  The callback to call on every S/G buffer segment until the operation finished.
+ * @param   pvUser       Opaque user data to pass in the given callback.
+ *
+ * @note This operation advances the internal buffer pointer of the S/G buffer.
+ */
+RTDECL(size_t) RTSgBufCopyFromFn(PRTSGBUF pSgBuf, size_t cbCopy, PFNRTSGBUFCOPYFROM pfnCopyFrom, void *pvUser);
 
 /**
