/*
* Copyright (c) 2005 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*/
#include "sm/generic.h"
SM_RCSID("@(#)$Id: hdrmodlwr.c,v 1.3 2006/12/29 01:21:56 ca Exp $")
#include "sm/assert.h"
#include "sm/error.h"
#include "sm/hdrmod.h"
#include "sm/reccom.h"
/*
** SM_HDRMODL_WR -- write header modifications into an RCB
**
** Parameters:
** sm_hdrmodhd -- header of header modification list
** rcb -- RCB to fill in
** rttp -- record type for type and position
** rthdr -- record type for header
**
** Returns:
** usual sm_error code
*/
sm_ret_T
sm_hdrmodl_wr(sm_hdrmodhd_P sm_hdrmodhd, sm_rcb_P rcb, uint32_t rttp, uint32_t rthdr)
{
sm_ret_T ret;
sm_hdrmod_P sm_hdrmod;
if (NULL == sm_hdrmodhd || HDRMODL_EMPTY(sm_hdrmodhd))
return SM_SUCCESS;
for (sm_hdrmod = HDRMODL_FIRST(sm_hdrmodhd);
sm_hdrmod != HDRMODL_END(sm_hdrmodhd);
sm_hdrmod = HDRMODL_NEXT(sm_hdrmod))
{
ret = sm_rcb_putv(rcb, 0,
SM_RCBV_INT2, rttp, sm_hdrmod->sm_hm_type, sm_hdrmod->sm_hm_pos,
SM_RCBV_CSTR, (sm_hdrmod->sm_hm_hdr != NULL) ? rthdr : RT_NOSEND,
sm_hdrmod->sm_hm_hdr,
SM_RCBV_END);
if (sm_is_err(ret))
return ret;
}
return SM_SUCCESS;
}
syntax highlighted by Code2HTML, v. 0.9.1