Use fc_net_write function is to send a header or a footer and a file that exists somewhere in the system. The fileName should be the full path name of a file.
PRInt32 fc_net_write(const char *fileName, const char *hdr, const char *ftr, PRUint32 hlen, PRUint32 flen, PRUint32 flags, PRIntervalTime timeout, Session *sn, Request *rq);
IO_OKAY if successful.
IO_ERROR if an error occurs.
FC_ERROR if an error in file handling occurs.
File to be inserted
Any header data, which can be NULL
Any footer data, which can be NULL
Length of the header data in bytes, which can be 0
Length of the footer data in bytes, which can be 0
ORed directives for this function. See Flags.
Timeout before this function aborts
Pointer to the request
Pointer to the session
This section describes the flags for fc_net_write() function.
Supplies the Content-Length header and does a PROTOCOL_START_RESPONSE
Does a PROTOCOL_START_RESPONSE
const char *fileName = "/docs/myads/file1.ad"; char *hdr = GenHdr(); // Implemented by plugin char *ftr = GenFtr(); // Implemented by plugin if(fc_net_write(fileName, hdr, ftr, strlen(hdr), strlen(ftr), FC_CNTLEN, PR_INTERVAL_NO_TIMEOUT, sn, rq) != IO_OKEY) { ereport(LOG_FAILURE, "fc_net_write() failed"); return REQ_ABORTED; }